Is it me or does it blow your mind that there is not one standard way
of importing something as common as CSS files into Django templates?
I realize there are a plethora of options as mentioned on the official
site here: http://docs.djangoproject.com/en/dev/howto/static-files/
None of which actually ended up working for me and instead ended up
using this:
urlpatterns in urls.py:
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/Users/home/djcode/mysite/media/
css/','show_indexes' : True}),
and then on my actual template page:
<link rel="stylesheet" type="text/css" href="static/my.css" />
I suppose I was feeling a little misdirected by the default
settings.py in my projects folder where CSS and other Media are
supposed to be stored.
ADMIN_MEDIA_PREFIX = 'media/' That was not used at all in the
solution I ended up using which does work.
My main complaint is this - for something so common as importing CSS
into django templates - why not just make it painfully obvious in the
documentation/djangobook with one golden way of doing so - why does
everything have to be so modular, etc? It starts to feel
counterproductive at a certain point - like why I am not just writing
this in python myself if there are going to be so many options. I
think django could use a little tightening up. I understand it's loose
coupling ways, etc - but don't use that as a shield for something
possibly unfinished? The solution I ended up using felt like a hack
for something so common. My two cents.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.