gunicorn_django error “cannot find myproject.settings in your PYTHONPATH”

StackOverflow https://stackoverflow.com/questions/7020162

  •  24-12-2020
  •  | 
  •  

سؤال

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