Gunicorn - 绑定错误

时间:2018-05-04 00:13:06

标签: python django gunicorn

我正在使用Ubuntu 14.04和Django 2.0.5。我正在尝试在DigitalOcean上启动一个Django服务器,我正在验证是否没有gunicorn工作,但事实并非如此。非常感谢任何提示,谢谢

遵循本指南:https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-debian-8

这是我运行时的终端错误

gunicorn --bind 0.0.0.0:8000 manaland.wsgi:application

gunicorn --bind 0.0.0.0:8000 wsgi:application

    root@django-manaland:/home/django/manaland# gunicorn --bind 0.0.0.0:8000 application.wsgi:application
[2018-05-04 00:03:02 +0000] [13969] [INFO] Starting gunicorn 19.4.5
[2018-05-04 00:03:02 +0000] [13969] [INFO] Listening at: http://0.0.0.0:8000 (13969)
[2018-05-04 00:03:02 +0000] [13969] [INFO] Using worker: sync
[2018-05-04 00:03:02 +0000] [13973] [INFO] Booting worker with pid: 13973
[2018-05-04 00:03:02 +0000] [13973] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
    __import__(module)
ImportError: No module named application.wsgi
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
    __import__(module)
ImportError: No module named application.wsgi
[2018-05-04 00:03:02 +0000] [13973] [INFO] Worker exiting (pid: 13973)
[2018-05-04 00:03:02 +0000] [13969] [INFO] Shutting down: Master
[2018-05-04 00:03:02 +0000] [13969] [INFO] Reason: Worker failed to boot.
root@django-manaland:/home/django/manaland# gunicorn --bind 0.0.0.0:8000 manaland.wsgi:application
[2018-05-04 00:16:28 +0000] [14083] [INFO] Starting gunicorn 19.4.5
[2018-05-04 00:16:28 +0000] [14083] [INFO] Listening at: http://0.0.0.0:8000 (14083)
[2018-05-04 00:16:28 +0000] [14083] [INFO] Using worker: sync
[2018-05-04 00:16:28 +0000] [14087] [INFO] Booting worker with pid: 14087
[2018-05-04 00:16:28 +0000] [14087] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
    __import__(module)
ImportError: No module named wsgi
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
    worker.init_process()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
    self.load_wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
    __import__(module)
ImportError: No module named wsgi
[2018-05-04 00:16:28 +0000] [14087] [INFO] Worker exiting (pid: 14087)
[2018-05-04 00:16:28 +0000] [14083] [INFO] Shutting down: Master
[2018-05-04 00:16:28 +0000] [14083] [INFO] Reason: Worker failed to boot.
root@django-manaland:/home/django/manaland# 

wsgi.py

import os
import sys

from django.core.wsgi import get_wsgi_application

# This allows easy placement of apps within the interior
# manaland directory.
app_path = os.path.abspath(os.path.join(
    os.path.dirname(os.path.abspath(__file__)), os.pardir))
sys.path.append(os.path.join(app_path, 'manaland'))



# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

我试过跟着

0 个答案:

没有答案