trying to load css/images in django
Posted
by tipu
on Stack Overflow
See other posts from Stack Overflow
or by tipu
Published on 2010-05-25T15:12:58Z
Indexed on
2010/05/25
15:21 UTC
Read the original article
Hit count: 227
I looked http://docs.djangoproject.com/en/dev/howto/static-files/ already, but am still confused on how to get css/image files loaded.
On my server, the images folder and css file are located at /srv/twingle/search
my urls.py
1 from django.conf.urls.defaults import *
2
3 # Uncomment the next two lines to enable the admin:
4 # from django.contrib import admin
5 # admin.autodiscover()
6
7 urlpatterns = patterns('twingle.search.views',
8 url(r'^$', 'index'),
9 url(r'^search/(?P<param>\w+)$', 'index'),
10 )
11 (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
12 {'document_root': '/srv/twingle/search'}),
13
I try to access my css as follows,
<link rel="stylesheet" type="text/css" href="/site_media/style.css" />
That's exactly how the tutorial says to do it, but it doesn't work. Any suggestions?
© Stack Overflow or respective owner