whitenoise
whitenoise copied to clipboard
Fix issue with static files on Windows
See https://github.com/evansd/whitenoise/issues/472 also https://code.djangoproject.com/ticket/34341
The probable takeaway from the discussion on Django side is that finders.find()
is really supposed to be called with an OS-standardized path.
I've mimicked what Django does to an url before calling finders.find()
:
- step 1 (strip url base / prefix) was already done by whitenoise
- step 2 (
url2pathname
) is obvious enough - step 3 (using
posixpath.normpath
, plus.lstrip('/')
) seems debatable considering that we're already afterurl2pathname
, but for the sake of mimicking Django I've included it
This needs a test to ensure there aren't regressions.