xref: /OK3568_Linux_fs/yocto/poky/bitbake/lib/toaster/toastermain/wsgi.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun"""
6*4882a593SmuzhiyunWSGI config for Toaster project.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunThis module contains the WSGI application used by Django's development server
9*4882a593Smuzhiyunand any production WSGI deployments. It should expose a module-level variable
10*4882a593Smuzhiyunnamed ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
11*4882a593Smuzhiyunthis application via the ``WSGI_APPLICATION`` setting.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunUsually you will have the standard Django WSGI application here, but it also
14*4882a593Smuzhiyunmight make sense to replace the whole Django WSGI application with a custom one
15*4882a593Smuzhiyunthat later delegates to the Django one. For example, you could introduce WSGI
16*4882a593Smuzhiyunmiddleware here, or combine a Django application with an application of another
17*4882a593Smuzhiyunframework.
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun"""
20*4882a593Smuzhiyunimport os
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
23*4882a593Smuzhiyun# if running multiple sites in the same mod_wsgi process. To fix this, use
24*4882a593Smuzhiyun# mod_wsgi daemon mode with each site in its own daemon process, or use
25*4882a593Smuzhiyun# os.environ["DJANGO_SETTINGS_MODULE"] = "Toaster.settings"
26*4882a593Smuzhiyunos.environ.setdefault("DJANGO_SETTINGS_MODULE", "toastermain.settings")
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# This application object is used by any WSGI server configured to use this
29*4882a593Smuzhiyun# file. This includes Django's development server, if the WSGI_APPLICATION
30*4882a593Smuzhiyun# setting points here.
31*4882a593Smuzhiyunfrom django.core.wsgi import get_wsgi_application
32*4882a593Smuzhiyunapplication = get_wsgi_application()
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun# Apply WSGI middleware here.
35*4882a593Smuzhiyun# from helloworld.wsgi import HelloWorldApplication
36*4882a593Smuzhiyun# application = HelloWorldApplication(application)
37