Reputation: 388
I have an entry in my urls.py:
url(r'^user/(?P<username>\w+)$', views.user_show, name='user_name'),
The problem is, whenever the view is rendered, the static files (CSS, Javascript etc) fail to load because Django prepends the URL match to the requests for the static files. So instead of requesting:
http://localhost:8000/static/myapp/css/main.css
it requests:
http://localhost:8000/user/static/myapp/css/main.css
Is there a way to stop the regex match from affecting the URL requests?
Thanks.
Upvotes: 1
Views: 284
Reputation: 166
are you using this to load the css file in the template?
{% load staticfiles %}
<link rel="stylesheet" href='{% static "css/main.css" %}'/>
Upvotes: 1