Friday, April 24, 2015

Re: static files and DEBUG = False

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVOzMEAAoJEH2EY3tf/UcFae0QAK7O7cMMxDU+BuBB4pUMl2Q1
e7Fs0KBhwu/WQ1Nyl3lYNViS/4oaqFA9rp8RiwcoS12HeDwACluFclkT5g5gd80P
SoVeGMzg3z8ALoK8U7IyOp6d/odKG5rT50Q+0JNq0+ZgF6JCuMwTL40rq4JeV1Iu
DcJGNo/BTcNEcK7gKXbaMOpec7JPxL6vl9BKB3twJf5SIo2+DrM+E1rdZsg5uiAM
lok7kyj7LzO1gvZwMgianqIsFOJdO+OBl4mPgs8fsvlp4FSj7x5h2lt2M4UE30bT
MNeIO+LA9IwNv2W+8uyHTcS1VusuIQ1cVulDS6q6DesXGQTnlK2VQlYB+VVYvnOd
FC7rIBilWUWBuK6LhbZXxWYF/1I7Wt1Hfm2LPLQe6XwHdd/f4kkae6mw6HAzxix8
Mmenl57Rvh7YjswSNJc4MrSZo8i5pbQhOCQlhHoaDlf/h9sRE3U2fiqgRBp/RWfg
HR+m8gEbNVT5G/umAgRkiRgN+8FTFEXqHDX1YZK1syxbSVOXJ/9KnATZo4pOBZwH
CtDlnp344CZXfEpbd9XOAncQiml3//GqedKkrKhSceDkrQWesHW3ZtIMLYHycA/N
sgdIdVoJq8WsXn92+B7p3EwXIvpfSxrzSYONS6iadieVGXJ8+W2r/tyHJSaBYsbl
Qfqb0TkzaK1TiueP5vSg
=BIc5
-----END PGP SIGNATURE-----
On 21/04/15 23:49, Egon.Frerich@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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/553B3300.8040108%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment