﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35312	staticurl_urlpatterns incorrectly uses STATIC_URL that prefixed using SCRIPT_NAME	yudhiwidyatama	nobody	"Deploying Django using Gunicorn with SCRIPT_NAME set to '/django', we get the url for static resources are correctly generated with '/django/static/' prefix, but the static url patterns is also prefixed with the '/django/static/'. This is wrong because url patterns will be compared with the PATH_INFO part of the URL without the script_name prefix. 

Reproduce step : 
1. create a django app with static directory containing image or css files.  
2. append static url pattern to site's urls.py by either appending 
urlpatterns += staticfiles_urlpatterns() 
or
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
(refer: https://docs.djangoproject.com/en/5.0/howto/static-files/)
3. serve using gunicorn by previously setting SCRIPT_NAME environment variable to /django
4. access the url served by gunicorn (http://localhost:8000/django/<appname>)
5. the application urls are served under /django prefix, the generated static urls also having the /django/static prefix.
6. accessing application url, gunicorn correctly renders pages, but not the static content

suggestion : 
a. change staticfiles_urlpatterns() in contrib/staticfiles/urls.py  to check whether the urlpatterns prefix starts with get_script_prefix(), and if so, strip the get_script_prefix() part from prefix
b. or change the settings.STATIC_URL in the howto page with expression that strips the SCRIPT_NAME part or get_script_prefix() part."	Bug	closed	contrib.staticfiles	5.0	Normal	invalid		Florian Apolloner Markus Holtermann	Unreviewed	0	0	0	0	0	0
