I'm having this weird error with a Django site which works fine with DEBUG = True
but is breaking in some interesting ways when DEBUG = False
.
One possibly generic thing is that inline javascript in the admin app gets escaped when DEBUG is True. So for example:
if(message && message!="error")
becomes
if(message && message!="error")
which is obviously unhelpful ...
Does anyone know of any generic reasons why this might happen?
Getting more specific, this site is using Django CMS 2.3.5 and the admin page I'm seeing this on is part of the CMS page admin. We have a minor template change in the admin system, but I have removed that template change and the bug persists. At any rate, the escaping appears to be happening in the Django template engine before the page is downloaded.
Any pointers, help, or good places to look at more closely appreciated.
Turned out to be the django-htmlmin middleware - which by default only kicks in when DEBUG
is set to False
. I have filed a bug.
The escaping is actually done by BeautifulSoup - I have asked another question about how to avoid the escaping.
As it was only admin pages that were affected, I worked around the problem by adding:
EXCLUDE_FROM_MINIFYING = ('^admin/', '^en/admin/')
to settings.py