Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django ManifestStaticFilesStorage not loading the correct static files

I am using a combination of django-storages and ManifestStaticFilesStorage to server static files and media from S3.

class StaticStorage(ManifestFilesMixin, S3BotoStorage):
    location = settings.STATICFILES_LOCATION

When I run collectstatic I can see the newest version of my JS file on S3 with the correct timestamp.

I can also see that file being referenced in the staticfiles.json manifest.

However looking at the site in the browser I am still seeing the old JS being pulled down, not the one in the manifest

What could be going wrong?

like image 437
Sam Hammamy Avatar asked Oct 30 '22 08:10

Sam Hammamy


1 Answers

The staticfiles.json seems to be loaded once when the server starts up (from the S3 instance). If you run collectstatic while the server is running it has no way of knowing that there were changes made to S3. You need to restart the server after running collectstatic if changes have been made.

like image 184
Tim Tisdall Avatar answered Jan 02 '23 20:01

Tim Tisdall