Opened 13 years ago

Closed 13 years ago

#17645 closed Bug (invalid)

runserver: not serving static for localhost

Reported by: shadow Owned by: nobody
Component: Core (Management commands) Version: dev
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

Description

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/handlers.py

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 by shadow, 13 years ago

Sorry, that fix should be:

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

comment:2 by shadow, 13 years ago

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 127.0.0.1 or not. So this probably can't be fixed reliably.

Never mind :]

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