Friday, 27 September 2013

Django template does not render CSS and Javascript

Django template does not render CSS and Javascript

I have the following folder structure for my project.
-App1
-App2
-App3
-App4
-static
-css
-bootstrap.css
-js
-bootstrap.js
-jquery.js
-tempaltes
-base.html
Now, in my base.html file i have
But, when i view the file the css and javascript does not seem to be
loaded on the page. In my, i have
settings.py
TEMPLATE_DIRS = "Absolute-path-to-base.html"
STATIC_URL = '/static'
STATICFILES_DIRS = 'Absolute-path-to-the above static folder'
As per all the docs and posts what i understood was, we need to keep all
the staticfiles in one place, viz, static folder in my case...and all the
templates (including base.html) in one place. After doing so, i open the
base.html in my browser to view the page...and it does not display the CSS
and the javascript. Instead when i place the file (base.html) in the
static folder things work fine.
Can someone point me in the right direction!

No comments:

Post a Comment