I
I
Ilya2015-10-29 01:40:31
Django
Ilya, 2015-10-29 01:40:31

css is not included in django, where is the error?

settings.py Connection example.
STATIC_URL = os.path.join(BASE_DIR, '/static/')

{% load staticfiles %}
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css'%}">
    <link rel="stylesheet" href="{% static 'css/bootstrap-theme.min.css'%}">

url.py Tried following the instructions for django 1.8
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from recipe.views import recipeListView

urlpatterns = [
    url(r'^$', recipeListView.as_view(), name='list'),
    url(r'^admin/', include(admin.site.urls)),
]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

log
[29/Oct/2015 01:39:41] "GET / HTTP/1.1" 200 742
[29/Oct/2015 01:39:42] "GET /static/css/bootstrap.min.css HTTP/1.1" 404 1777

trace
Page not found (404)
Request Method:	GET
Request URL:	http://127.0.0.1:8000/static/css/bootstrap.min.css
Raised by:	django.views.static.serve
'css/bootstrap.min.css' could not be found

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2015-10-29
@nuBacuk

Solution for developer mode:

STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)

A
Arsen Abakarov, 2016-09-24
@ArsenAbakarov

The solution is to inflate the statics with a normal web server, not Django

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question