Monday, January 17, 2011

What A Mri Is Looking For

Add Django style sheet

To add stylesheets, the directory of images and javascript files so that Django knows where is everything and directions. One way to solve this is: suppose we have the following hierarchy of directories within the main project.


$ tree templates /
templates /

, , :
settings.STATIC_ROOT +' templates / images'
}),
( r'js / (? P \u0026lt;path> .*)$' , 'django.views.static.serve' also we have to include at the beginning of the file urls.py
,
{'DOCUMENT_ROOT'
:
settings.STATIC_ROOT + 'templates / js'
}) _______________________________________________________
the amount needed to use the variable STATIC_ROOT: _______________________________________________________


 
import settings _______________________________________________________
Now we have to define this variable in settings.py . What we do is put as the path to the application: _______________________________________________________
STATIC_ROOT = '/ path / to / app /'
_______________________________________________________ And finally, we need to update the list TEMPLATE_DIRS with the url to the directory template: _______________________________________________________
STATIC_ROOT + 'templates /' , _______________________________________________________
With this, we have all you need to use CSS in your application. When reference is made to pick what style sheet in html, it should point to the root of the template, which would read:
\u0026lt; link
href = " / css / style.css "rel
=" stylesheet "type

=" text / css "

   

/
>

   



References
   
Django-doc



0 comments:

Post a Comment