Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 20, 2011 00:35:19

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django + CSS


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 django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 24th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support