Skip to content

Commit 3908ec5

Browse files
committed
added example wsgi
1 parent fd1abbd commit 3908ec5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

example/wsgi.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
WSGI config for demo_project project.
3+
4+
This module contains the WSGI application used by Django's development server
5+
and any production WSGI deployments. It should expose a module-level variable
6+
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7+
this application via the ``WSGI_APPLICATION`` setting.
8+
9+
Usually you will have the standard Django WSGI application here, but it also
10+
might make sense to replace the whole Django WSGI application with a custom one
11+
that later delegates to the Django one. For example, you could introduce WSGI
12+
middleware here, or combine a Django application with an application of another
13+
framework.
14+
15+
"""
16+
import os
17+
18+
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
19+
# if running multiple sites in the same mod_wsgi process. To fix this, use
20+
# mod_wsgi daemon mode with each site in its own daemon process, or use
21+
# os.environ["DJANGO_SETTINGS_MODULE"] = "demo_project.settings"
22+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.local")
23+
24+
# This application object is used by any WSGI server configured to use this
25+
# file. This includes Django's development server, if the WSGI_APPLICATION
26+
# setting points here.
27+
from django.core.wsgi import get_wsgi_application
28+
application = get_wsgi_application()
29+
30+
# Apply WSGI middleware here.
31+
# from helloworld.wsgi import HelloWorldApplication
32+
# application = HelloWorldApplication(application)

0 commit comments

Comments
 (0)