Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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


For example, if we have a line in 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 Changed 8 years ago by Mathieu Agopian

Cc: mathieu.agopian@… added
Resolution: invalid
Status: newclosed

According to the line 46 in django/views/ file, os.path.join is used to glue the document_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 the document_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 !

comment:2 Changed 8 years ago by…

OK. I just noticed that the comments in 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 Changed 8 years ago by Mathieu Agopian

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.

Note: See TracTickets for help on using tickets.
Back to Top