MCPcopy
hub / github.com/django/django / get_internal_wsgi_application

Function get_internal_wsgi_application

django/core/servers/basehttp.py:29–54  ·  view source on GitHub ↗

Load and return the WSGI application as configured by the user in ``settings.WSGI_APPLICATION``. With the default ``startproject`` layout, this will be the ``application`` object in ``projectname/wsgi.py``. This function, and the ``WSGI_APPLICATION`` setting itself, are only useful

()

Source from the content-addressed store, hash-verified

27
28
29def get_internal_wsgi_application():
30 """
31 Load and return the WSGI application as configured by the user in
32 ``settings.WSGI_APPLICATION``. With the default ``startproject`` layout,
33 this will be the ``application`` object in ``projectname/wsgi.py``.
34
35 This function, and the ``WSGI_APPLICATION`` setting itself, are only useful
36 for Django's internal server (runserver); external WSGI servers should just
37 be configured to point to the correct application object directly.
38
39 If settings.WSGI_APPLICATION is not set (is ``None``), return
40 whatever ``django.core.wsgi.get_wsgi_application`` returns.
41 """
42 from django.conf import settings
43
44 app_path = getattr(settings, "WSGI_APPLICATION")
45 if app_path is None:
46 return get_wsgi_application()
47
48 try:
49 return import_string(app_path)
50 except ImportError as err:
51 raise ImproperlyConfigured(
52 "WSGI application '%s' could not be loaded; "
53 "Error importing module." % app_path
54 ) from err
55
56
57def is_broken_pipe_error():

Callers 7

get_handlerMethod · 0.90
test_successMethod · 0.90
test_defaultMethod · 0.90
test_bad_moduleMethod · 0.90
test_bad_nameMethod · 0.90

Calls 3

get_wsgi_applicationFunction · 0.90
import_stringFunction · 0.90

Tested by 6

test_successMethod · 0.72
test_defaultMethod · 0.72
test_bad_moduleMethod · 0.72
test_bad_nameMethod · 0.72