本文整理汇总了Python中django.core.servers.basehttp.get_internal_wsgi_application方法的典型用法代码示例。如果您正苦于以下问题:Python basehttp.get_internal_wsgi_application方法的具体用法?Python basehttp.get_internal_wsgi_application怎么用?Python basehttp.get_internal_wsgi_application使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.core.servers.basehttp
的用法示例。
在下文中一共展示了basehttp.get_internal_wsgi_application方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_default
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
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
示例2: handle
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
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'])
示例3: make_wsgi_application
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
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()
示例4: get_handler
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
def get_handler(self, *args, **options):
"""
Returns the default WSGI handler for the runner.
"""
return get_internal_wsgi_application()
示例5: test_success
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
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)
示例6: test_bad_module
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
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()
示例7: test_bad_name
# 需要导入模块: from django.core.servers import basehttp [as 别名]
# 或者: from django.core.servers.basehttp import get_internal_wsgi_application [as 别名]
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()