#15913 closed Uncategorized (invalid)
trailing slash
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | mathieu.agopian@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
http://docs.djangoproject.com/en/1.0/howto/static-files/
For example, if we have a line in settings.py that says:
STATIC_DOC_ROOT = '/path/to/media'
Doesn't this need to be STATIC_DOC_ROOT = '/path/to/media/' ?
Change History (3)
comment:1 by , 14 years ago
Cc: | added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 by , 14 years ago
OK. I just noticed that the comments in settings.py
suggest that the other similar extensions need to be '/x/y/z/'
rather than 'x/y/z'
. I don't know anything about os.path.join
.
Why would the other paths need a trailing slash? Don't they use os.path.join
as well?
comment:3 by , 14 years ago
I can see only one reference about a mandatory trailing slash, and it's for ADMIN_MEDIA_PREFIX. I believe in the admin templates, they use it "as is", eg:
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
Note the "missing" slash before "css", thus the need of the trailing slash in this case for ADMIN_MEDIA_PREFIX.
According to the line 46 in
django/views/static.py
file,os.path.join
is used to glue thedocument_root
and the file path that needs to be served.As
os.path.join
doesn't care about a trailing slash when gluing, I believe the trailing slash for thedocument_root
isn't mandatory.After a quick test, I can also confirm this behavior: with or without a trailing slash, it works as expected.
I'll thus close this ticket as invalid, but please, if you feel this should definitely be changed, reopen it and explain why !