css w/ django
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
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home