I can run gunicorn_django on the root dir of my project, but when i set all thing in supervisor I got this error message "Error: Can't find 'myproject.settings' in your PYTHONPATH."

my supervisor setting:

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 configure file gunicorn.conf.py

bind = "127.0.0.1:9004" 
logfile ="/var/www/vhosts/myproject.net/log/gunicorn.log" 
workers = 3

UPDATE: problem solved, it was because that www-data didn't have the read permission to settings.py and other files needed

有帮助吗?

解决方案

Make sure gunicorn is in your INSTALLED_APPS and change command to this:

command=/path/to/python /path/to/manage.py run_gunicorn -c /path/to/gunicorn.conf.py 

其他提示

Also, check for missing Python dependencies. I've had Django crash in a similar fashion when there were missing Python libs.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top