15π
β
However, serving CSS as a view seems like it would cause a significant amount of overhead in a file that is constantly requested, so this is probably not a good solution.
And what if you would generate that CSS once?
- Default CSS is:
/common/css.css
- Member customize CSS, now
<link />
elements points to/user-specific/123.css?ts=123123123
.123
is of course an identifier of the member, andts
parameter contains a timestamp β a date of last CSS modification - Make sure that your CSS generator sets proper HTTP headers responsible for client-side caching
- User browser request a CSS file β server replies with simple
304 Not Modified
header β there is no need for any script execution or contents download - When member modifies his CSS then you just update
ts
β once again just a single request is needed
π€Crozin
5π
Do the CSS dynamically via a view as normal, but use aggressive caching so that it loads quickly.
0π
You can try django mediagenerato, actually I read this Q and I was searching for solution like you, then I found that Django-mediagenerator
I didnβt tried it yet but it seams to be a solution.
π€UXE
- Django template indentation guideline
- Access token from view
- Adding a "through" table to django field and migrating with South?
- Django remove user from all groups
Source:stackexchange.com