Setting DEBUG = False produces internal server error without any trace or log #282

Closed
romanr opened this Issue May 7, 2013 · 6 comments

Comments

Projects
None yet
2 participants

romanr commented May 7, 2013

If I set Debug=True, everything works fine. Once I set DEBUG=False and restart it does not work anymore showing erro page on any URL including /admin. Nothing in logs.

romanr commented May 7, 2013

Problem is, if ALLOWED_HOSTS is unset with DEBUG=True it does not trigger fatal error. And with DEBUG=False it triggers fatal error.

Owner

nijel commented May 7, 2013

ALLOWED_HOSTS is Django settings, which should be safe to skip (has defaults meaning no checking). Are you sure it is cause of the problems?

romanr commented May 7, 2013

IF ALLOWED_HOSTS is not present in weblate/setting.py, it displays error page for every request.
and ALLOWED_HOSTS is not present in settings_example.py in recent versions.

romanr commented May 7, 2013

I receive error by email:

Traceback (most recent call last):

 File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/core/handlers/base.py", line 92, in get_response
   response = middleware_method(request)

 File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/middleware/common.py", line 57, in process_request
   host = request.get_host()

 File "/usr/local/lib/python2.6/dist-packages/Django-1.5.1-py2.6.egg/django/http/request.py", line 72, in get_host
   "Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)

romanr commented May 7, 2013

It also does not work if ALLOWED HOSTS set as

ALLOWED_HOSTS = ""
ALLOWED_HOSTS = *
ALLOWED_HOSTS = "*"
ALLOWED_HOSTS = ".com"
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ()

Weblate only works if ALLOWED_HOSTS is set to actual hostname in quotes.

and ALLOWED_HOSTS is not present in settings_example.py so this makes it a serious hurdle for anyone who does not know this information.

Owner

nijel commented May 9, 2013

Okay, I finally got to read Django documentation - this setting is required since Django 1.5. Will adjust documentation and sample config to match this change.

nijel was assigned May 9, 2013

nijel closed this in dac0900 May 9, 2013

@nijel nijel added a commit that referenced this issue May 9, 2013

@nijel nijel Add check for ALLOWED_HOSTS into performance report in admin inteface.
This will help detecting users running in debug mode that something is
wrong (issue #282).
8bb0fc0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment