Z
Z
zigen2015-03-31 11:02:26
Django
zigen, 2015-03-31 11:02:26

Why is Django not loading CSS?

Good afternoon.
Probably a boring question, but nevertheless:
Janga 1.7 does not see templates
In settings:

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

In template:

{% load static files %}
<link rel="stylesheet" type="text/css" href="{% static 'weddidea/css/bootstrap2.min.css' %}" />
    <link rel="stylesheet" type="text/css" href="{% static 'weddidea/css/style.css' %}" />

But in the request:
[31/Mar/2015 10:53:42] "GET /static/weddidea/css/style.css HTTP/1.1" 404 1670

Although this css really lies there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Lyutoev, 2015-04-01
@loader777

Usually in the main urls.py you need to insert something like this (to work on a dev server):
After the basic rules

if settings.DEBUG:
    urlpatterns += patterns(
    'django.views.static',
    (r'media/(?P.*)',
    'serve',
    {'document_root': settings.MEDIA_ROOT}),
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question