Opened 4 years ago
Closed 4 years ago
#32175 closed Uncategorized (invalid)
FORCE_SCRIPT_NAME documentation doesn't explain how the prefix is prepended with regard to relative vs. absolute paths.
Reported by: | Mason Egger | Owned by: | Nayan sharma |
---|---|---|---|
Component: | Documentation | Version: | 3.1 |
Severity: | Normal | Keywords: | documentation |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
When FORCE_SCRIPT_NAME is set it will prepend the prefix to URLs for STATIC_URL and MEDIA_URL. However, if either the static root is an absolute path (staring with a /) then this will be completely skipped. Since Django defaults to STATIC_URL being set to /static/
it is not obvious that you may need to set this to be STATIC_URL = "static/"
, removing the leading slash.
The docs should have a note or warning in this section https://docs.djangoproject.com/en/3.1/ref/settings/#force-script-name explaining this.
Change History (2)
comment:1 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 4 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
This behavior is already documented in MEDIA_URL and STATIC_URL docs and it's not related with
FORCE_SCRIPT_NAME
, which is only a way to override the server-provided value ofSCRIPT_NAME
.