In order to avoid confusion between my production and development instance (where DEBUG = True
), I'd like to override the CSS of my bootstrap Navbar in development (only) to show up e.g. in red instead of blue.
What is the most elegant way to accomplish this?
I can override get_context_data()
everywhere to include my settings.DEBUG
, or inherit from newly generated base classes, but that doesn't seem very DRY.
You can leverage django debug context processor, which allows you to use debug
template variable in every template.
This value is equal to settings.DEBUG
so you can use it to override you css E.g.
{% if debug %}
<style>
.nav { background-color: red }
</style>
{% endif %}