Python django.core.servers.basehttp.get_internal_wsgi_application() Examples
The following are 12
code examples of django.core.servers.basehttp.get_internal_wsgi_application().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.core.servers.basehttp
, or try the search function
.
Example #1
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 6 votes |
def test_default(self): """ If ``WSGI_APPLICATION`` is ``None``, the return value of ``get_wsgi_application`` is returned. """ # Mock out get_wsgi_application so we know its return value is used fake_app = object() def mock_get_wsgi_app(): return fake_app from django.core.servers import basehttp _orig_get_wsgi_app = basehttp.get_wsgi_application basehttp.get_wsgi_application = mock_get_wsgi_app try: app = get_internal_wsgi_application() self.assertIs(app, fake_app) finally: basehttp.get_wsgi_application = _orig_get_wsgi_app
Example #2
Source File: livereload.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
def handle(self, *args, **options): m = re.match(naiveip_re, options['addrport']) if m is None: raise CommandError('"%s" is not a valid port number ' 'or address:port pair.' % options['addrport']) addr, _ipv4, _ipv6, _fqdn, port = m.groups() if not port.isdigit(): raise CommandError("%r is not a valid port number." % port) if addr: if _ipv6: raise CommandError('IPv6 addresses are currently not supported.') application = get_internal_wsgi_application() server = Server(application) for file in os.listdir('.'): if file[0] != '.' and file[:2] != '__' and os.path.isdir(file): server.watch(file) server.serve(host=addr, port=port, liveport=options['liveport'])
Example #3
Source File: django_wsgi.py From jbox with MIT License | 5 votes |
def make_wsgi_application(): # validate models s = StringIO() if get_validation_errors(s): s.seek(0) error = s.read() msg = "One or more models did not validate:\n%s" % error print(msg, file=sys.stderr) sys.stderr.flush() sys.exit(1) translation.activate(settings.LANGUAGE_CODE) if django14: return get_internal_wsgi_application() return WSGIHandler()
Example #4
Source File: runserver.py From GTDWeb with GNU General Public License v2.0 | 5 votes |
def get_handler(self, *args, **options): """ Returns the default WSGI handler for the runner. """ return get_internal_wsgi_application()
Example #5
Source File: django_wsgi.py From Flask-P2P with MIT License | 5 votes |
def make_wsgi_application(): # validate models s = StringIO() if get_validation_errors(s): s.seek(0) error = s.read() msg = "One or more models did not validate:\n%s" % error print(msg, file=sys.stderr) sys.stderr.flush() sys.exit(1) translation.activate(settings.LANGUAGE_CODE) if django14: return get_internal_wsgi_application() return WSGIHandler()
Example #6
Source File: runserver.py From luscan-devel with GNU General Public License v2.0 | 5 votes |
def get_handler(self, *args, **options): """ Returns the default WSGI handler for the runner. """ return get_internal_wsgi_application()
Example #7
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_success(self): """ If ``WSGI_APPLICATION`` is a dotted path, the referenced object is returned. """ app = get_internal_wsgi_application() from .wsgi import application self.assertIs(app, application)
Example #8
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_bad_module(self): msg = "WSGI application 'wsgi.noexist.app' could not be loaded; Error importing" with self.assertRaisesMessage(ImproperlyConfigured, msg): get_internal_wsgi_application()
Example #9
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_bad_name(self): msg = "WSGI application 'wsgi.wsgi.noexist' could not be loaded; Error importing" with self.assertRaisesMessage(ImproperlyConfigured, msg): get_internal_wsgi_application()
Example #10
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_success(self): """ If ``WSGI_APPLICATION`` is a dotted path, the referenced object is returned. """ app = get_internal_wsgi_application() from .wsgi import application self.assertIs(app, application)
Example #11
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_bad_module(self): msg = "WSGI application 'wsgi.noexist.app' could not be loaded; Error importing" with self.assertRaisesMessage(ImproperlyConfigured, msg): get_internal_wsgi_application()
Example #12
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_bad_name(self): msg = "WSGI application 'wsgi.wsgi.noexist' could not be loaded; Error importing" with self.assertRaisesMessage(ImproperlyConfigured, msg): get_internal_wsgi_application()