问题
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