Search code examples
cssdjango

Changes made to (static) CSS file not reflecting in Django development server


I am making a Web app using Django and was having some trouble getting the changes made in the CSS file (which is stored in the static directory of my app) to reflect onto the development server.

To be clear the server is able to access static files, however, it is currently stuck on an old iteration of my CSS file. A similar problem had occurred a few weeks ago, when any change I made to the CSS file wasn't showing up. That problem fixed itself after a few days.

However, not getting immediate visual feedback is extremely frustrating. I have tried all of the following to rectify the problem:

  • My DEBUG is set to 'True'
  • I have provided a STATIC_URL
  • I tried 'collecting' the static files. The command worked but the dev server is still not reflecting changes made to the CSS file
  • I provided a STATIC_ROOT, STATICFILES_DIR and STATICFILES_FINDER. Currently these are commented out as I realized some of these are for production only or are unnecessary for development.

My static resources are kept in the 'static' directory of one of my apps -- 'post_it_gen' which is part of the project. According to the documentation this should be automatically searched by Django.

Any new suggestions would be greatly appreciated.


Solution

  • If you develop locally using Django's server there's no need to use the collectstatic command, it is only meant to collect all static dependencies to a single access point where you can point your 'real' server to, e.g. apache, lighttpd, nginx etc.

    As for your problem, you insinuate it 'magically' fixes it self after a few days. Have you tried resetting your browser's cache?