#32304: Django adds spurious "/" prefix to settings.STATIC_URL="http://server/" -------------------------------------+------------------------------------ Reporter: Adam Hooper | Owner: nobody Type: Bug | Status: new Component: contrib.staticfiles | Version: 3.1 Severity: Release blocker | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------ Changes (by Mariusz Felisiak):
* cc: Florian Apolloner (added) * component: Core (Other) => contrib.staticfiles * severity: Normal => Release blocker * stage: Unreviewed => Accepted Comment: Thanks for the report, as a workaround you can set the [https://docs.djangoproject.com/en/3.1/ref/settings/#force-script-name FORCE_SCRIPT_NAME] setting to an empty string: {{{#!python FORCE_SCRIPT_NAME = '' }}} Ticket #9202 was rejected and will not be fixed. I think it should be fine to add `http://` and `https://` to recognizing absolute paths, e.g. {{{ diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 23fee7d5b7..c2ddc942db 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -139,7 +139,7 @@ class LazySettings(LazyObject): except (ValidationError, AttributeError): pass # Don't apply prefix to absolute paths. - if value.startswith('/'): + if value.startswith(('http://', 'https://', '/')): return value from django.urls import get_script_prefix return '%s%s' % (get_script_prefix(), value) }}} Florian, What do you think? -- Ticket URL: <https://code.djangoproject.com/ticket/32304#comment:5> 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/068.0ade04edf8e509feca788dca0eb10494%40djangoproject.com.
