Zoneo
Zoneo

Reputation: 83

Django + Sass + Compressor: loading cached css files, unable to update or remove

Aloha!

I have been working on a django project and recently switched to SASS for styling. The initial compiling on the css file seemed to work fine, but once I went to update the file I noticed the changes were not reflected in the browser.

Upon further investigation, I have determined the issue is a cached file located at static/CACHE/css/output.ad5d8929a444.css however I am unable to find this file anywhere in the filesystem, and running commands such

./manage.py compilescss --remove
./manage.py collectstatic

does not resolve the issue.

I have tried looking around for other questions and it seems this question is most closely related however that suggestion did not work in my case. I have tried deleting all browser data and I typically only use incognito mode in Chrome for development anyways as to avoid caching files in the first place. I have tried searching for the file inside of my filesystem, however, it seems I am unable to locate the statice/CACHE folder.

My question is how do I force django to use the new css file, and where do I find the cache folder? This is my first time using SASS for styling, so any advice in that department is appreciated.

Settings.py

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, '/my_portfolio/my_portfolio/static/')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'my_portfolio/static'),
]
STATICFILES_FINDERS = [
    'compressor.finders.CompressorFinder',
]

MEDIA_ROOT = os.path.join(BASE_DIR, 'my_portfolio/img')
MEDIA_URL = '/img/'


#SASS
STATIC_FILES_FINDERS = [
    'compressor.finders.CompressorFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'sass_processor.finders.CssFinder',
]
# SASS_PROCESSOR_INCLUDE_DIRS = [
#     os.path.join(BASE_DIR, 'my_portfolio/static/my_portfolio'),
# ]
SASS_PROCESSOR_ROOT = os.path.join(PROJECT_ROOT, 'static')
COMPRESS_PRECOMPILERS = (
    ('text/x-scss', 'django_libsass.SassCompiler'),
)
COMPRESS_ENABLED= True

base.html

{% load static %}
{% load sass_tags %}
{% load compress %}

    {% compress css %}
        <link rel="stylesheet" href="{% sass_src 'my_portfolio/stylesheet.scss' %}" type='text/css'>
    {% endcompress %} 

If you need any further information please let me know and I will update the question accordingly.

Thank you for any and all tips or advice you can provide!

Upvotes: 3

Views: 955

Answers (1)

Royalbishop101
Royalbishop101

Reputation: 187

Your browser may have cached the stylesheet. Clear your browser's cache and reload the page and see if it changes.

Upvotes: 0

Related Questions