Opened 5 years ago

Closed 5 years ago

#20148 closed Bug (invalid)

Error 404 cause exception 500

Reported by: ti@… Owned by: nobody
Component: Python 2 Version: 1.5
Severity: Normal Keywords: HTTP 404, HTTP 500
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes



With Django 1.5, when I set DEBUG = False and go to production (at webfaction) or when I use runserver that error crash the server. So, I need stop it and start it again (restart dosn't work).

The error: when I access a url not found the error (with DEBUG = False) returns a HTTP error 500 and crash the server with WSGI script.


Change History (3)

comment:1 Changed 5 years ago by Claude Paroz

Could you please give us a traceback of the error?

comment:2 Changed 5 years ago by anonymous

raceback (most recent call last):

File "/home/zarafalcao/webapps/app_site/lib/python2.7/django/core/handlers/", line 92, in get_response

response = middleware_method(request)

File "/home/zarafalcao/webapps/app_site/lib/python2.7/django/middleware/", line 57, in process_request

host = request.get_host()

File "/home/zarafalcao/webapps/app_site/lib/python2.7/django/http/", line 72, in get_host

"Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)

SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS):

GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
META:{'DOCUMENT_ROOT': '/usr/local/apache2/htdocs',

'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4',
'HTTP_HOST': '',
'HTTP_HTTPS': 'off',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31',
'PATH_INFO': u'/',
'PATH_TRANSLATED': '/home/zarafalcao/webapps/app_site/myproject/myproject/',
'REMOTE_PORT': '43263',
'SCRIPT_FILENAME': '/home/zarafalcao/webapps/app_site/myproject/myproject/',
'SERVER_ADMIN': '[no address given]',
'SERVER_PORT': '80',
'SERVER_SOFTWARE': 'Apache/2.2.17 (Unix) mod_wsgi/3.4 Python/2.7.3',
'mod_wsgi.application_group': '|',
'mod_wsgi.callable_object': 'application',
'mod_wsgi.enable_sendfile': '0',
'mod_wsgi.input_chunked': '0',
'mod_wsgi.listener_host': ,
'mod_wsgi.listener_port': '28023',
'mod_wsgi.process_group': 'app_site',
'mod_wsgi.queue_start': '1364423849605156',
'mod_wsgi.request_handler': 'wsgi-script',
'mod_wsgi.script_reloading': '1',
'mod_wsgi.version': (3, 4),
'wsgi.errors': <mod_wsgi.Log object at 0x7fe4fc705970>,
'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7fe51c738b70>,
'wsgi.input': <mod_wsgi.Input object at 0x7fe4fc7058b0>,
'wsgi.multiprocess': True,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>

comment:3 Changed 5 years ago by Simon Charette

Resolution: invalid
Status: newclosed

Looking at the traceback it looks like you didn't set ALLOWED_HOSTS.

Please have a look at the documentation.

Reopen if it doesn't solve it for you.

Note: See TracTickets for help on using tickets.
Back to Top