I can't load the css files
Posted
by mfalcon
on Stack Overflow
See other posts from Stack Overflow
or by mfalcon
Published on 2010-04-22T11:37:04Z
Indexed on
2010/04/22
11:43 UTC
Read the original article
Hit count: 319
I want to load some .css files to my Django project but I don't know why they aren't loaded. The css files are located at "/myproject/media/css".
settings.py:
import os.path
PROJECT_DIR = os.path.dirname(__file__)
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
urls.py:
from django.conf import settings
...
(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
)
base.html:
<link rel="stylesheet" type="text/css" media="all" href="{{ MEDIA_ROOT }}css/myStyle.css" />
© Stack Overflow or respective owner