1

I am working on a django application and using less for generating CSS. On my localhost, everything works fine and changing less file updates CSS almost immediately.

However, when I deploy to server (apache2, wsgi), the old css files are rendered for a long time. I was wondering how can I fix this? Is there a way I can forcefully invalidate the precompiler cache so that new CSS files are generated?

Thank you

Manas Paldhe
  • 766
  • 1
  • 10
  • 32

1 Answers1

0

I've been using django_compressor for managing Sass. In my deployment script I use the django_compressor compress offline setting, which generates a new filename for the compressed static files. I started doing this to get around server caching and browser caching problems, and it's been scaling nicely as my static files have gotten larger.

Here's the docs on offline compression or precompression

In my deployment script I run manage.py compress which generates the new file names.

This probably isn't the simplest solution but it's a good time investment to set up.

petroleyum
  • 678
  • 1
  • 6
  • 11
  • How is this relevant? This is for compressing the css files. I am not worried about compression. I am interested to generate css from the less files. – Manas Paldhe Feb 18 '16 at 00:47
  • There's an option to turn off the compression if you don't want it. Even without compression I find that compressor is a good tool for managing Sass and Less files during deployment. Compressor will take one or multiple Less files and generate a css file with a unique name per deployment, getting around any caching problems. – petroleyum Feb 18 '16 at 02:43