Hi, so I seem to have a problem with static files. I deployed a Django app to heroku serving static files with uvicorn, whitenoise and the compressor. I have the usual things required by whitenoise and the compressor checked (middleware, static root, compress enabled, etc) but here’s the problem: when i recompile with npx the styles and push to heroku, the django app seems to be looking for old styles that don’t exist anymore. It throws an error that css_some_hash wasn’t found (the compressed file). What I don’t understand is why it keeps looking for old styles. Locally it doesn’t happen, even with debug false but when i push to heroku it does. heroku automatically collectsstatic so the styles are present. Not sure if it’s a thing of the compressor but even when i precompress with compress offilne, this still persists: it looks for things that don’t exist anymore and thereofre it doesn’t load any style. It could be that whitenoise is caching things (in the storagemanifest) and I need to declare some no-cache flag but i’m not sure to which extent this makes sense because i removed the manifest and it still persists. Please, anyone has had a similar problem and figured it out? Very much thanks in advance.
oh, ok i found what’s happening. locally it works because if you run the server with debug false, it generates the compressed file in static/cache/css. when collecting static in heroku, it can be found no problem, as whitenoise is looking for it in the manifest and it has it. now, if you don’t run the server locally w debug false, the manifest and the cache aren’t refreshed so the styles can’t be found. it’s a solution but it seems rather hackish. ok, the way is to do compress_offline = True because when debug false the compressor doesn’t compress stuff and whitenoise wouldn’t look either for new things. but idk why it didn’t work when i did compress_true before. it didn’t work before because i was doing compress_offline IN heroku and it was hitting walls. For anyone with this problem, which i believe is common, COMPRESS_OFFLINE = True and run locally python manage.py compress --force (the force flag only if it complains bc it isn’t ideal). then you can push to heroku and everyting will work.