Opened 14 months ago
Last modified 14 months ago
#34892 closed Bug
Static files aren't served correctly on dev server when DEBUG and FORCE_SCRIPT_NAME are enabled — at Version 4
Reported by: | EugeneM | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | 4.2 |
Severity: | Normal | Keywords: | FORCE_SCRIPT_NAME DEBUG STATIC_URL |
Cc: | Florian Apolloner | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Found out that the ticket was closed but still is interesting in mention about incorrectly truncated path in 404 message.
Why it's ok ?
Change History (4)
comment:1 by , 14 months ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 14 months ago
Has patch: | unset |
---|
comment:3 by , 14 months ago
Steps to reproduce:
- bootstrap
mkdir tmp && cd tmp virtualenv venv . venv/bin/activate pip install "Django<5" django-admin startproject testme 10.100.100.10:9999 cd testme && mkdir static && touch static/test.css
- nano testme/settings.py && add in the end of file and save
ALLOWED_HOSTS = ['*',] STATICFILES_DIRS = [ f'{BASE_DIR}/static' ]
- test if all is ok in browser: http://10.100.100.10:9999/static/test.css
- nano testme/settings.py # add in the end of file and save
FORCE_SCRIPT_NAME = '/sub'
- test in browser: http://10.100.100.10:9999/static/test.css and get "Page not found (404) 'tic/test.css' could not be found"
- do fix
- test if all is ok in browser: http://10.100.100.10:9999/static/test.css
- disable FORCE_SCRIPT_NAME and check http://10.100.100.10:9999/static/test.css
Replying to Mariusz Felisiak:
As far as I'm aware this is a duplicate of #30634, #7930, #31724 and few other tickets.
Just because somebody missed it long time ago doesn't mean it's ok.
"Page not found" message with incorrectly truncated file name hints that something went wrong.
Moreover if you can check request.path and 'request.path_path' and see a difference
comment:4 by , 14 months ago
Description: | modified (diff) |
---|---|
Resolution: | needsinfo |
Status: | closed → new |
Hello Eugene, thanks for your ticket.
Could you please provide some more details on how to reproduce this issue? A description of the necessary setup and/or a small Django test project as a reproducer would be ideal.
Even better a regression test if you would be up for it!
For now I'll mark this report as
needsinfo
, but I'll reopen as soon as we have more information to properly triage this issue.Thanks!