Skip to content

Hashed filenames not being updated #819

@chrisspen

Description

@chrisspen

If I run:

manage.py collectstatic --noinput

Pipeline correctly generates the collected, minimized and hashed file in my static folder. e.g. /static/js/index.59efce78ac06.js

However, the {% javascript 'index_js' %} template tag does not generate the corresponding filename. The hash it uses seems to get stuck on the last hash and never updates to the one just generated. I have to kill and restart runserver for it to use the new hash.

This only seems to happen when DEBUG=False, so it's not a problem in development. However, this is a huge problem for a production environment, because it means you have to restart your Django process every single time you update your static media and run collectstatic.

My pipeline settings are:

PIPELINE = {
    'CSS_COMPRESSOR': 'pipeline.compressors.cssmin.CSSMinCompressor',
    'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor',
    'PIPELINE_ENABLED': True,
    'PIPELINE_COLLECTOR_ENABLED': True,
    'STYLESHEETS': {
        'global_css': {
            'source_filenames': (...),
            'output_filename':
            'css/global.css',
            'extra_context': {
                'media': 'screen,projection',
            },
        },
        'index_css': {
            'source_filenames': (...,),
            'output_filename': 'css/index.css',
            'extra_context': {
                'media': 'screen,projection',
            },
        },
    },
    'JAVASCRIPT': {
        'index_js': {
            'source_filenames': (...,),
            'output_filename': 'js/index.js',
        }
    },
}

STATICFILES_STORAGE = 'pipeline.storage.PipelineManifestStorage'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions