Django WSGI and Gunicorn

一笑奈何 提交于 2019-12-10 17:59:46

问题


This might be really stupid question; I'm trying to deploy Django application using Gunicorn. However, I just created wsgi.py which looks like below (wsgi.py is in my root project folder):

import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")

# 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.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

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

and now I ran:

python manage.py run_gunicorn

Will Gunicorn automatically picks up this wsgi.py? How does this work? (not sure what wsgi is doing). Or do i need to specify something?


回答1:


If you have gunicorn listed in INSTALLED_APPS of Django settings module, the command is:

python manage.py run_gunicorn

Not the command you give.




回答2:


I have Gunicorn to host my django site and this is the config details hope this is helpfull



来源:https://stackoverflow.com/questions/12066441/django-wsgi-and-gunicorn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!