Gunicorn 在过去三年中运行相同的 Django 配置和代码时出错



在过去的三年里,下面的枪角兽配置运行良好:

[program:hys]
command= /usr/local/bin/gunicorn /var/www/h/o/u67098/public_html/project/apps/,/var/www/h/o/u67098/public_html/project/,/var/www/h/o/u67098/public_html/apps/,/var/www/h/o/u67098/public_html/ project.wsgi:application -b=0.0.0.0:8001 --workers=3 --timeout=90 --graceful-timeout=10 --log-level=INFO --log-file /var/www/h/o/u67098/public_html/logs/gun.log
directory = /var/www/h/o/u67098/public_html/project/
user = hys
autostart=true
autorestart=true
stdout_logfile = /var/www/h/o/u67098/public_html/logs/gunicorn_supervisor.log
stderr_logfile= /var/www/h/o/u67098/public_html/logs/gunicorn_err_supervisor.log
redirect_stderr = true ; Save stderr in the same log
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8

自纽约以来,我收到此错误:

[2020-01-05 10:45:16 +0000] [20624] [INFO] Starting gunicorn 19.7.1
[2020-01-05 10:45:16 +0000] [20624] [INFO] Listening at: http://0.0.0.0:8001 (20624)
[2020-01-05 10:45:16 +0000] [20624] [INFO] Using worker: sync
[2020-01-05 10:45:16 +0000] [20629] [INFO] Booting worker with pid: 20629
[2020-01-05 10:45:16 +0000] [20629] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python2.7/dist-packages/gunicorn-19.7.1-py2.7.egg/gunicorn/util.py", line 352, in import_app
__import__(module)
ImportError: Import by filename is not supported.

代码有效,我可以在 Django 中启动开发服务器,没有错误。 独角兽自我似乎也在工作,它在命令行中响应。我没有其他项目可以测试它,但我确实重新安装了它,问题仍然存在。

姜戈 1.11.2 蟒蛇 2.7.3 独角兽 19.7.1

任何想法这里有什么问题?

尝试在配置的environment设置中设置PYTHONPATH

environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,PYTHONPATH=/var/www/h/o/u67098/public_html/project/apps/:/var/www/h/o/u67098/public_html/project/:/var/www/h/o/u67098/public_html/apps/:/var/www/h/o/u67098/public_html/

最新更新