I am trying to implement django-compressor
in my project $ Python manage.py compressing
works with the following setup:
& lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; {% Load compress%} {% compress js%} & lt; Script type = "text / javascript" src = "{{STATIC_URL}} lib / js / lodash.compat.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "{{STATIC_URL}} Lib / JS / junkie-1.11.1.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "{{STATIC_URL}} Lib / JS / JCOR.JS" & Gt; & Lt; / Script & gt; {% Endcompress%}
This works:
Compression ... done 2 blocks (s) compressed from 21 templates.
However, if I add any other templatetag
anywhere to that file, it throws an error:
{% load extra%} & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" & gt; & Lt; Top & gt; {% Load compress%} {% compress js%} & lt; Script type = "text / javascript" src = "{{STATIC_URL}} lib / js / lodash.compat.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "{{STATIC_URL}} Lib / JS / junkie-1.11.1.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "{{STATIC_URL}} Lib / JS / JCOR.JS" & Gt; & Lt; / Script & gt; {% Endcompress%}
This error is:
$ python manage.py compress ... compressor.exceptions.OfflineGenerationError: No 'sec' Template tags found in templates Try running a short command with the --filick-link and / or - extension = extension
Why is this error happening? There is nothing with Django-Context in the extra
tag template tags.
According to the source code, when one of your templates has a syntax error, becomes offline generation error
. To debug this error, you can see the verbosity & gt; 0
will print this template name which causes an error.
Hope this syntax can help you debug errors. The last resort of debugging is to use in PDB and checks that why compressor_nodes
is empty import PDB; Pdb.set_trace ()
No comments:
Post a Comment