fix(settings): configure STORAGES so collectstatic uploads to Spaces - #324
Merged
Conversation
🔍 Quality Check Results
🎉 All quality checks passed! This PR is ready for review. Triggered by commit 8c1ef51 • View Details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
collectstatichas not been able to upload to DigitalOcean Spaces since the Django 5 upgrade. Every file in the bucket is a pre-Django-5 leftover, and any newly added static file 404s permanently.Found while verifying #322 on staging:
launch-time.jsreturned 404 while every pre-existing asset returned 200.Cause
Django 5.1 removed
DEFAULT_FILE_STORAGEandSTATICFILES_STORAGE. Setting them raises nothing — Django ignores them and uses its local-filesystem defaults. This repo sets both and never definesSTORAGES.Verified in the running staging pod (Django 5.2.17):
The failure is quiet because it is only half broken:
STATIC_URLis configured separately and still points at Spaces, so the app keeps generating correct bucket URLs whilecollectstaticwrites to local disk. Assets already in the bucket kept working, hiding it; only new files broke. Runningcollectstaticfails withYou're using the staticfiles app without having set the STATIC_ROOT setting.DEFAULT_FILE_STORAGEwas ignored the same way, sodefaultstorage silently fell back to local disk too.Change
Replace both removed settings with
STORAGES, in bothUSE_LOCAL_STORAGEbranches, and add theSTATIC_ROOTthe local branch needs forcollectstatic.This changes production storage behavior —
defaultreturns toapi.custom_storages.DefaultStorage(Spaces) instead of the local disk it has silently been using. That is the intended configuration, but it is a real prod change and the reason this is a standalone PR rather than part of #322.Tests
src/spacelaunchnow/tests_storages.pyasserts the resolved backend class, not the setting string — a string assertion would have passed throughout the outage.Confirmed meaningful: reverting the settings and re-running gives 4/4 failures with
Docs
Added
docs/runbooks/static-assets.md(publishing a static file, the--clearwarning, how to verify) and linked it plus the existing runbook from the README.After merge
Deploying does not upload static files. Once this is live on staging I still need to run
collectstaticfrom the pod and confirmlaunch-time.jsreturns 200 — that is what finally lights up local-time rendering from #322.🤖 Generated with Claude Code