2👍
✅
1) To disable heroku’s automatic collectstatic, run:
heroku config:set DISABLE_COLLECTSTATIC=1
2) Add the following to settings.py to use a table in your database for the collectfast
‘s caching. Commit and push the change to heroku.
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'collectfast': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'collectfast_cache',
'TIMEOUT': 60,
'OPTIONS': {
'MAX_ENTRIES': 10000
},
},
}
COLLECTFAST_CACHE = 'collectfast'
4) To create the required cache table in the database, run:
heroku run createcachetable
5) To restore heroku’s automatic collectstatic, run:
heroku config:unset DISABLE_COLLECTSTATIC
Each deploy will now correctly use collectfast to collect modified static files to s3.
Source:stackexchange.com