当我用gunicorn部署项目时,我犯了一个错误

时间:2018-05-23 01:31:05

标签: python flask gunicorn flask-script

当我使用gunicorn部署项目时,我找不到该模块。当我使用测试环境时,这是正常的。

Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
        worker.init_process()
      File "/usr/lib/python2.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
        self.load_wsgi()
      File "/usr/lib/python2.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
        self.wsgi = self.app.wsgi()
      File "/usr/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
        self.callable = self.load()
      File "/usr/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
        return self.load_wsgiapp()
      File "/usr/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
        return util.import_app(self.app_uri)
      File "/usr/lib/python2.7/site-packages/gunicorn/util.py", line 350, in import_app
        __import__(module)
      File "/home/iHome_Flask/ihome_pyhon02/manage.py", line 4, in <module>
        from flask_script import Manager
    ImportError: No module named flask_script
    [2018-05-23 09:15:46 +0000] [29933] [INFO] Worker exiting (pid: 29933)
    [2018-05-23 09:15:46 +0000] [29928] [INFO] Shutting down: Master
    [2018-05-23 09:15:46 +0000] [29928] [INFO] Reason: Worker failed to boot.
    (flask_py2) [root@iZbp1bvf97jli08phztpplZ ihome_pyhon02]# vim manage.py

1 个答案:

答案 0 :(得分:0)

我的猜测是flask_script是作为全局环境的一部分安装的,而不是虚拟环境的一部分。 你能做pip show Flask-Script吗?