Why do we have to provide WSGI_APPLICATION variable in Django settings

十年热恋 提交于 2019-12-04 10:09:26

Ultimately the wsgi file is the starting point of django application, right?

Not necessarily. The documentation for WSGI_APPLICATION explains what this setting is for:

The full Python path of the WSGI application object that Django’s built-in servers (e.g. runserver) will use.

Any server you set up has to know where the WSGI file is. If you're using an external server it will look in its own settings. If you're using Django's development server, it will check Django's settings. So the circularity you noticed is a consequence of the fact that the Django application can be started in a number of different ways.

IMHO, wsgi.py plays a role of pointing to where your django project is, for WAS like Apache or something else.

Therefore wsgi.py starts outside of django, it needs django settings.

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