3

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!

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

1 Comment

I test my site in Incognito mode, which deletes the cached images when the browser is closed and I always use a fresh browser for new tests. I haven't worked on this project in a little while as I ran into another issue im stuck on, but when I pick it back up again I will be sure to test this to verify its not the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.