Django Gunicorn ImportError:没有名为django.core.wsgi的模块

时间:2014-11-20 19:46:39

标签: django gunicorn django-settings

我创建了一个Django应用程序,但现在计划在站点的某些区域使用一些异步(实时)功能。在做了一些研究后,我想我应该使用gevent-socketio,因此我需要将应用服务器切换到Gunicorn

我已经陷入了部署Gunicorn的第一个障碍,我使用命令sudo apt-get install gunicorn安装并尝试使用gunicorn project.wsgi:application运行我的应用程序,但它失败并产生以下错误:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 473, in spawn_worker
    worker.init_process()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 100, in init_process
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 115, in wsgi
    self.callable = self.load()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 33, in load
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 362, in import_app
    __import__(module)
  File "/home/alex/django_projects/fantasymatchday_1/fantasymatchday_1/wsgi.py", line 13, in <module>
    from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
2014-11-20 17:31:45 [6605] [INFO] Worker exiting (pid: 6605)
2014-11-20 17:31:45 [6600] [INFO] Shutting down: Master
2014-11-20 17:31:45 [6600] [INFO] Reason: Worker failed to boot.

有人可以从这里找到我需要做的事情的线索吗?

我正在使用python 3.4.0和Django 1.6

1 个答案:

答案 0 :(得分:3)

您必须在同一环境中安装djangogunicorn 如果您使用virtualenv,请确保两者都在同一个虚拟环境中。