Do I need to make a custom storage or custom template to handle query strings in static file URLs or endpoints?
Using the new static template in Django>=1.4 works fine for simple endpoints and URLs For example, the following works fine: {% load staticfiles %} <!-- Bootstrap --> <link href="{% static 'bootstrap/3.3.1/css/bootstrap.min.css' %}" rel= "stylesheet"> <!-- Optional theme --> <link rel="stylesheet" href="{% static 'bootstrap/3.3.1/css/bootstrap-theme.min.css' %}"> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="{% static 'jquery/jquery-1.11.1.min.js' %}"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="{% static 'bootstrap/3.3.1/js/bootstrap.min.js' %}"></script> However if the ULR or endpoint of the static argument contains a query string then it gets URLencoded and then the query doesn't work. For example, this doesn't work: {% load staticfiles %} <script src="{% static 'mathjax/2.4/MathJax.js?config=TeX-AMS_HTML' %}" type="text/javascript"></script> because the "?" turns into "%3" and the "=" turns into "%3D" and then the js doesn't run. BTW: I know that there is a MathJax Django extension (https://pypi.python.org/pypi/django-mathjax/0.0.5) but I want to understand how to correctly handle this issue for any URL. I have seen examples for installing custom storage for s3 which appends the signature to the static URL (https://django-storages.readthedocs.org/en/latest/index.html) but AFAICT this topic wasn't addressed in the main Django documentation. Is the answer as simple as subclassing StaticFilesStorage (https://docs.djangoproject.com/en/1.7/ref/contrib/staticfiles/#staticfiles-storages) and overloading the Storage.url() method? Or is a better path to do what the mathjax django extension does and make a totally different template? Or am I using the wrong static template? IE {% load static %} instead of {% load staticfiles %}? Is there any harm in using {{ STATIC_URL }} instead of the newer static template {% get_static_prefix %}? Thanks! -- 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+unsubscr...@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/26b996f2-301f-4824-8673-54bc1fc88106%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.