I am new to Django framework and kindly consider if my question is novice.
I have created a polls application using the django framwork. I am unable to figure out how to make my stylesheet dynamic for front end. As i dont want to call it in my base_site.html or index.html files as I am also multiple views render different template files. My only aim is to how i define my app’s stylesheet on one place and applicable through out my application.
If i’m reading your question correctly the first part wants to make a stylesheet that is dynamic???
For that you could use something like
Django admin follows convention of adding
{% block extra_head %}(or something similar, sorry don’t remember specifics)Which is exactly what it sounds like a block that is in the
<head>tag. This will let you load a stylesheet from any template. Just define that block in yourbase_site.htmland implement it when you extendbase_site.htmlBut then at the end of your question you it seems you want to define style sheet in one place and include that stylesheet for every request?
Perhaps you could set up a directive in your settings.py
'DEFAULT_STYLESHEETand include that in yourbase_site.htmltemplate. Put the css in the block extra_head. If you need to override it just implement that block and viola!