Opened 6 years ago

Closed 6 years ago

#17645 closed Bug (invalid)

runserver: not serving static for localhost

Reported by: shadow Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: shadow Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


runserver will only serve static files if STATIC_URL is relative. This makes sense if STATIC_URL includes a domain pointing to another server. However, it denies the possibility of including a localhost domain (as is needed by my current project).

I've currently worked around this by modifying: django/contrib/staticfiles/

def _should_handle(self, path):
    return True

Sorry, I haven't had time to consider any side effects of this, but it's working for me at the moment.

Change History (2)

comment:1 Changed 6 years ago by shadow

Sorry, that fix should be:

    def _should_handle(self, path):
        return path.startswith(self.base_url[2])

comment:2 Changed 6 years ago by shadow

Resolution: invalid
Status: newclosed

Actually, now that I think about it... there won't be an easy way of knowing whether the domain is pointing to or not. So this probably can't be fixed reliably.

Never mind :]

Note: See TracTickets for help on using tickets.
Back to Top