﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29571	Error 500 when accessing static files that do not exist	dmitriybch	nobody	"Hi,

I have deployed static files according to the guide:
https://docs.djangoproject.com/en/2.0/howto/static-files/

Everything works fine except one thing:
When accessing non-existing static files in production with DEBUG = False it returns 500 error instead of 404 error.

Here is the error log:

''2018-07-18 02:01:27,325: TypeError: 'NoneType' object is not callable
2018-07-18 02:01:27,325:   File ""/home/dmitriybch/.virtualenvs/venv_test/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py"", line 67, in __call__
2018-07-18 02:01:27,325:     return super().__call__(environ, start_response)
2018-07-18 02:01:27,325: 
2018-07-18 02:01:27,326:   File ""/home/dmitriybch/.virtualenvs/venv_test/lib/python3.6/site-packages/django/core/handlers/wsgi.py"", line 146, in __call__
2018-07-18 02:01:27,326:     response = self.get_response(request)
2018-07-18 02:01:27,326: 
2018-07-18 02:01:27,326:   File ""/home/dmitriybch/.virtualenvs/venv_test/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py"", line 62, in get_response
2018-07-18 02:01:27,326:     return super().get_response(request)
2018-07-18 02:01:27,326: 
2018-07-18 02:01:27,327:   File ""/home/dmitriybch/.virtualenvs/venv_test/lib/python3.6/site-packages/django/core/handlers/base.py"", line 81, in get_response
2018-07-18 02:01:27,327:     response = self._middleware_chain(request)''

For example:
Here is the correct link that works well:
https://www.umtest.ru/static/LaikaClientsSite/res/index/popularlogos/lg.png

And here is incorrect link
https://www.umtest.ru/static/LaikaClientsSite/res/index/popularlogos/lg9090909.png
That should return 404 but for some reason returns 500 error.

When I run the site on localhost it works correct both with DEBUG = True and with DEBUG = False. On production it works only if DEBUG = True.


PythonAnywhere said this is Django issue so I posted a ticket here.

Thanks.


"	Bug	closed	contrib.staticfiles	2.0	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
