Vin*_*fer 8 python django supervisord gunicorn
我git在我的主文件夹中克隆了一个项目,让我们称之为/home/telessaude.所以项目根位于/home/telessaude/telessaude_branch_master
如果我在Django项目主文件夹(/ home/telessaude/telessaude_branch_master)内并发出一个诸如此类的gunicorn comman
gunicorn -w 2 -b 0.0.0.0:8000 telessaude.wsgi_dev:application --reload --timeout 900
gunicorn开始并且工作正常.但是...如果我尝试在上面的一个目录(/ home/telessaude)上运行相同的命令,我会收到以下错误:
telessaude@ubuntu:~$ gunicorn -w 2 -b 0.0.0.0:8000 telessaude.wsgi_dev:application --reload --timeout 900
[2017-03-22 16:39:28 +0000] [10405] [INFO] Starting gunicorn 19.6.0
[2017-03-22 16:39:28 +0000] [10405] [INFO] Listening at: http://0.0.0.0:8000 (10405)
[2017-03-22 16:39:28 +0000] [10405] [INFO] Using worker: sync
[2017-03-22 16:39:28 +0000] [10410] [INFO] Booting worker with pid: 10410
[2017-03-22 16:39:28 +0000] [10410] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 557, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 136, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python2.7/dist-packages/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/util.py", line 357, in import_app
__import__(module)
ImportError: No module named telessaude.wsgi_dev
Run Code Online (Sandbox Code Playgroud)
我也试过在我的主文件夹中运行gunicorn
gunicorn -w 2 -b 0.0.0.0:8000 telessaude_branch_master.telessaude.wsgi_dev:application --reload --timeout 900
和
gunicorn -w 2 -b 0.0.0.0:8000 /home/telessaude/telessaude_branch_master/telessaude.wsgi_dev:application --reload --timeout 900
但他们都没有工作.谁能告诉我如何解决这个问题?我需要从任何文件夹运行gunicorn,因为我必须将它作为"命令"参数添加到主管.
我没有使用虚拟环境.
小智 35
chdir在执行命令之前,您可以使用Gunicorn 的标志更改为项目目录.
gunicorn -w 2 -b 0.0.0.0:8000 --chdir /home/telessaude/telessaude_branch_master telessaude.wsgi_dev:application --reload --timeout 900
Run Code Online (Sandbox Code Playgroud)