我可以在项目的根目录上运行gunicorn_django,但是当我在主管中设置所有内容时,我收到此错误消息“错误:在您的PYTHONPATH中找不到'myproject.settings'。”
我的主管设置:
command=/usr/local/django/myproject/gunicorn_django -c /usr/local/django/myproject/gunicorn.conf.py
directory=/usr/local/django/myproject
user=www-data
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/supervisord.log
redirect_stderr=true
gunicorn_django配置文件gunicorn.conf.py
bind = "127.0.0.1:9004"
logfile ="/var/www/vhosts/myproject.net/log/gunicorn.log"
workers = 3
更新:问题解决了,原因是因为www-data没有对settings.py及其他所需文件的读取权限
答案 0 :(得分:1)
确保gunicorn
位于INSTALLED_APPS
,并将command
更改为:
command=/path/to/python /path/to/manage.py run_gunicorn -c /path/to/gunicorn.conf.py
答案 1 :(得分:0)
另外,检查缺少的Python依赖项。当缺少Python库时,我已经以类似的方式崩溃了Django。