Deployment with Django and Uwsgi

扶醉桌前 提交于 2019-12-24 07:51:55

问题


My problem is that uwsgi doesn't server static files of the django project. I am very new in web development and I was following this tutorial with uswgi deployment (https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html) I stuck on the stage when uwsgi run django. I was expecting that uwsgi will server static files after I ran:

python manage.py collectstatic

and then

uwsgi --http :8000 --module myproject.wsgi

But when I get on 127.0.0.1:8000 I see something like this enter image description here

The structure of the project is trivial

--myproject:
-----myproject:
-------myproject:
----------init.py
----------settings.py
----------urls.py
----------wsgi.py
-------static
-------manage.py
-------db.sqlite3
-----venv

Thank you for any hint or help.


回答1:


The easiest way to do this with uwsgi alone is to add the static-map parameter, i.e. --static-map=/static=/path/to/my/proj/ect/static.

(You'll want to do this for your MEDIA_ROOT too if you use it.)



来源:https://stackoverflow.com/questions/41676875/deployment-with-django-and-uwsgi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!