#34892: Static files aren't served correctly on dev server when DEBUG and
FORCE_SCRIPT_NAME are enabled
-------------------------------------+-------------------------------------
     Reporter:  EugeneM              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  contrib.staticfiles  |                  Version:  4.2
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  FORCE_SCRIPT_NAME    |             Triage Stage:
  DEBUG STATIC_URL                   |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by EugeneM):

 Steps to reproduce:

 * bootstrap
 {{{
 mkdir tmp && cd tmp
 virtualenv venv
 . venv/bin/activate
 pip install "Django<5"
 cd testme && mkdir static && touch static/test.css
 django-admin startproject testme 10.100.100.10:9999
 }}}


 * 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

 Replying to [comment:2 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

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34892#comment:3>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018b0a6d80d6-d858d758-e5cb-4fc6-92be-1f8ae7d4e1e4-000000%40eu-central-1.amazonses.com.

Reply via email to