Django change css / sass with database values

I am creating a website where I want to be able to do a lot of color and css settings derived from the theme model. Right now, I can think of applying colors as in the code below, but not much to understand why this is bad practice.

class Theme(models.Model):
    url_color =  models.CharField(max_length=64)

<a href style="color: {{ context_processor.url_color }}">

      

I am also using sass to generate the css file and it would be helpful if the answer could make the color values ​​from the database work with sass lighten and dim.

+3


source to share


1 answer


You can research https://www.grooveui.com They claim to allow the creation of multiple website themes from SASS files.

I believe they do the logic of storing variables in a database and creating independent SASS files for each theme.



I am using the service in one of my personal projects and it seems to be working fine.

+1


source







All Articles