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
()
| 27 | |
| 28 | |
| 29 | def 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 | |
| 57 | def is_broken_pipe_error(): |