Clark
unread,Mar 16, 2012, 7:15:10 PM3/16/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Trying to get django pages to recognize a css file....having trouble
getting all of the correct settings right in the settings.py, urls.py
etc...plus there appears to be several different ways to do this.
I'm on a Mac OSX and I've tried this:
settings.py:
MEDIA_ROOT = 'full-path-to-site-on-machine/documents/mysite/mysite/
media/'
MEDIA_URL = 'media'
urls.py:
from django.conf.urls.defaults import *
from mysite.views import hello, current_datetime, hours_ahead, about
from mysite import settings
urlpatterns = patterns('',
(r'^hello/$', hello),
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^about/$', about),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)
base.html
<link rel="stylesheet" href="/media/style_sheets/style.css" type="text/
css" />
Thanks