使用 Django 和 Uwsgi 部署
Deployment with Django and Uwsgi
我的问题是 uwsgi 不提供 django 项目的静态文件服务器。我是 Web 开发的新手,我正在按照本教程进行 uswgi 部署 (https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html)
uwsgi 运行 django的时候卡在舞台上了。我原以为 uwsgi 会在 运行:
之后提供静态文件服务
python manage.py collectstatic
然后
uwsgi --http :8000 --module myproject.wsgi
但是当我进入 127.0.0.1:8000 时,我看到了这样的东西
enter image description here
项目的结构很简单
--myproject:
-----myproject:
-------myproject:
----------init.py
----------settings.py
----------urls.py
----------wsgi.py
-------static
-------manage.py
-------db.sqlite3
-----venv
感谢您的任何提示或帮助。
单独使用 uwsgi 执行此操作的最简单方法是添加 static-map
参数,即 --static-map=/static=/path/to/my/proj/ect/static
.
(如果您使用它,您也会想为您的 MEDIA_ROOT
执行此操作。)
我的问题是 uwsgi 不提供 django 项目的静态文件服务器。我是 Web 开发的新手,我正在按照本教程进行 uswgi 部署 (https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html) uwsgi 运行 django的时候卡在舞台上了。我原以为 uwsgi 会在 运行:
之后提供静态文件服务python manage.py collectstatic
然后
uwsgi --http :8000 --module myproject.wsgi
但是当我进入 127.0.0.1:8000 时,我看到了这样的东西 enter image description here
项目的结构很简单
--myproject:
-----myproject:
-------myproject:
----------init.py
----------settings.py
----------urls.py
----------wsgi.py
-------static
-------manage.py
-------db.sqlite3
-----venv
感谢您的任何提示或帮助。
单独使用 uwsgi 执行此操作的最简单方法是添加 static-map
参数,即 --static-map=/static=/path/to/my/proj/ect/static
.
(如果您使用它,您也会想为您的 MEDIA_ROOT
执行此操作。)