#34028: Django 'static' template tag fails to generate URLs with SCRIPT_NAME
prefix
---------------------------------+--------------------------------------
Reporter: Stewart Adam | Owner: nobody
Type: Bug | Status: closed
Component: Template system | Version: 4.0
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Florian Apolloner):
* status: new => closed
* resolution: => worksforme
Comment:
Hi,
I cannot reproduce this. It works as it should:
{{{#!python
from django.template import engines
django_engine = engines['django']
from django.conf import settings
print(settings.FORCE_SCRIPT_NAME)
print(settings.STATIC_URL) # Note: in settings.py it is 'static/' but the
output here will include FORCE_SCRIPT_NAME
print(django_engine.from_string("{% load static %}{% static 'test_file'
%}").render())
}}}
> None of these calls attempt to verify SCRIPT_NAME or inject STATIC_URL.
This isn't true: `{% static %}` uses `staticfiles_storage` which in turn
uses `StaticFilesStorage` which sets the prefix to `STATIC_URL` which
includes `FORCE_SCRIPT_NAME`. Feel free to reopen with a reproducer if you
are still running into issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/34028#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701836edce8d4-e8ee5397-9d05-4891-b285-c988996451a8-000000%40eu-central-1.amazonses.com.