static files and DEBUG = False

117 views
Skip to first unread message

Egon.F...@gmx.de

unread,
Apr 21, 2015, 5:49:33 PM4/21/15
to django...@googlegroups.com
Hi,

settings.py contains ALLOWED_HOSTS with the host in the form ".example.com". With DEBUG = True I get the complete page. But if I set DEBUG = False the static files are not found so I get only the content.

If DEBUG = True  the apache access log the static files are shown with HTTP-code 200. If DEBUG = False Apache is looking for the static files two times. The first try gives  status code 301, the second try gives  status code 500.

Any idea why this happens?

Egon

Florian Schweikert

unread,
Apr 25, 2015, 2:24:38 AM4/25/15
to django...@googlegroups.com
On 21/04/15 23:49, Egon.F...@gmx.de wrote:
> settings.py contains ALLOWED_HOSTS with the host in the form
> ".example.com". With DEBUG = True I get the complete page. But if I set
> DEBUG = False the static files are not found so I get only the content.

Django does not serve static files if DEBUG=False, and you really don't
want to do that.

> If DEBUG = True the apache access log the static files are shown with
> HTTP-code 200. If DEBUG = False Apache is looking for the static files
> two times. The first try gives status code 301, the second try gives
> status code 500.
>
> Any idea why this happens?

It's a bad idea to serve statics with Django.
It's ok for debugging, but not for production.
If you already use apache serve static files with Apache directly.

--
Florian

signature.asc
Reply all
Reply to author
Forward
0 new messages