#25598: support for SCRIPT_NAME for static tag and FileField.url
--------------------------+------------------------------------------------
Reporter: | Owner: nobody
DheerendraRathor |
Type: New | Status: new
feature |
Component: | Version: master
Uncategorized |
Severity: Normal | Keywords: script_name, static_url, media_url
Triage Stage: | Has patch: 0
Unreviewed |
Easy pickings: 0 | UI/UX: 0
--------------------------+------------------------------------------------
By default, `static` tag just appends `STATIC_URL` in the path. When
running on subpath it results in incorrect static url.
This problem can be solved with appending `SCRIPT_NAME` in to `SCRIPT_URL`
in `settings.py`
This can be easily added into default django `static` tag and
`django.contrib.staticfiles` tag as following:
{{{
def render(self, context):
url = self.url(context)
# Updating url here with request.META['SCRIPT_NAME']
if self.varname is None:
return url
context[self.varname] = url
return ''
}}}
On more research I found that `FileSystemStorage` and `StaticFilesStorage`
ignores `script_name` as well.
We might have to do a lot of changes but I think it's worth the efforts.
--
Ticket URL: <https://code.djangoproject.com/ticket/25598>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/059.8b313d182aa162563c2e83faa03c53c2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.