mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Added runserver validation to detect if DEBUG=False and ALLOWED_HOSTS is empty.
Refs #19875.
This commit is contained in:
parent
4e94c84e50
commit
96c71d423d
2 changed files with 20 additions and 0 deletions
|
@ -1192,6 +1192,21 @@ class ManageRunserver(AdminScriptTestCase):
|
|||
self.cmd.handle(addrport="deadbeef:7654")
|
||||
self.assertServerSettings('deadbeef', '7654')
|
||||
|
||||
class ManageRunserverEmptyAllowedHosts(AdminScriptTestCase):
|
||||
def setUp(self):
|
||||
self.write_settings('settings.py', sdict={
|
||||
'ALLOWED_HOSTS': [],
|
||||
'DEBUG': False,
|
||||
})
|
||||
|
||||
def tearDown(self):
|
||||
self.remove_settings('settings.py')
|
||||
|
||||
def test_empty_allowed_hosts_error(self):
|
||||
out, err = self.run_manage(['runserver'])
|
||||
self.assertNoOutput(out)
|
||||
self.assertOutput(err, 'CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.')
|
||||
|
||||
|
||||
##########################################################################
|
||||
# COMMAND PROCESSING TESTS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue