diff options
| author | Tim Graham <timograham@gmail.com> | 2013-06-09 15:07:23 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-06-09 15:08:29 -0400 |
| commit | 96c71d423db13825869a929b25d6b83dde67c170 (patch) | |
| tree | 3a96d633c0467071bf242ab15f0aa220f5a87c53 /django | |
| parent | 4e94c84e50b960405d5708d8d9528c44c7dabe83 (diff) | |
Added runserver validation to detect if DEBUG=False and ALLOWED_HOSTS is empty.
Refs #19875.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/runserver.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py index c4a0b78cd4..f5a701cd23 100644 --- a/django/core/management/commands/runserver.py +++ b/django/core/management/commands/runserver.py @@ -40,6 +40,11 @@ class Command(BaseCommand): return get_internal_wsgi_application() def handle(self, addrport='', *args, **options): + from django.conf import settings + + if not settings.DEBUG and not settings.ALLOWED_HOSTS: + raise CommandError('You must set settings.ALLOWED_HOSTS if DEBUG is False.') + self.use_ipv6 = options.get('use_ipv6') if self.use_ipv6 and not socket.has_ipv6: raise CommandError('Your Python does not support IPv6.') |
