Opened 4 years ago

Last modified 4 years ago

#32304 closed Bug

Django adds spurious "/" prefix to settings.STATIC_URL="http://server/" — at Version 4

Reported by: Adam Hooper Owned by: nobody
Component: contrib.staticfiles Version: 3.1
Severity: Release blocker Keywords:
Cc: Florian Apolloner Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam Hooper)

Here's a piece of settings from a totally reasonable, sensible, okay Docker integration-test environment

STATIC_URL = "http://minio/static/"

Django 3.1 will implicitly add "/" to the URL, so my URLs look like /http://minio/static/images/app-icons/favicon.ico

The features and bugs that interact here:

  • commit c574bec, adding feature #25598, prepends SCRIPT_NAME to STATIC_URL when STATIC_URL isn't a URL.
  • bug #9202 and #25418: according to Django, "http://minio/static/" isn't a valid URL. (It is.)

Top me, the easiest fix is to address #9202 / #25418. Or to make STATIC_URL use some logic that is different from URLValidator.

Change History (4)

comment:1 by Adam Hooper, 4 years ago

Description: modified (diff)

comment:2 by Adam Hooper, 4 years ago

Description: modified (diff)

comment:3 by Adam Hooper, 4 years ago

My workaround was to create a phony URL and point to it in /etc/hosts.

Yes, really. https://github.com/CJWorkbench/cjworkbench/commit/6aec10f441f5392bda7df247cddc8828b52a0c84

comment:4 by Adam Hooper, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top