Django returns error 500 when DEBUG = False, ignores ALLOWED_HOSTS

I have a django application that always returns a 500 error page. I have the following code in settings.py:

import os DEBUG = True TEMPLATE_DEBUG = DEBUG try: from local_settings import * except ImportError, e: pass 

and local_settings.py:

 DEBUG = False ALLOWED_HOSTS = ['*'] 

I have this on the local computer, it always returns an 500 error code, regardless of what I type in ALLOWED_HOSTS

+4
source share
1 answer

Django has the line ALLOWED_HOSTS = [] right next to the database configuration section. If you put your ALLOWED_HOSTS in front of this line, your changes will be ignored. I think this is the cause of your problem.

-2
source

Source: https://habr.com/ru/post/1491160/


All Articles