Skip to content

fix(settings): configure STORAGES so collectstatic uploads to Spaces - #324

Merged
ItsCalebJones merged 1 commit into
masterfrom
fix/storages-django5
Aug 12, 2026
Merged

fix(settings): configure STORAGES so collectstatic uploads to Spaces#324
ItsCalebJones merged 1 commit into
masterfrom
fix/storages-django5

Conversation

@ItsCalebJones

Copy link
Copy Markdown
Owner

collectstatic has 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.js returned 404 while every pre-existing asset returned 200.

Cause

Django 5.1 removed DEFAULT_FILE_STORAGE and STATICFILES_STORAGE. Setting them raises nothing — Django ignores them and uses its local-filesystem defaults. This repo sets both and never defines STORAGES.

Verified in the running staging pod (Django 5.2.17):

STATICFILES_STORAGE (deprecated) -> api.custom_storages.StaticStorage
STORAGES  -> {'default':     FileSystemStorage,
              'staticfiles': StaticFilesStorage}     <- Django's DEFAULTS
ACTUAL staticfiles storage -> ConfiguredStorage (local)

The failure is quiet because it is only half broken: STATIC_URL is configured separately and still points at Spaces, so the app keeps generating correct bucket URLs while collectstatic writes to local disk. Assets already in the bucket kept working, hiding it; only new files broke. Running collectstatic fails with You're using the staticfiles app without having set the STATIC_ROOT setting.

DEFAULT_FILE_STORAGE was ignored the same way, so default storage silently fell back to local disk too.

Change

Replace both removed settings with STORAGES, in both USE_LOCAL_STORAGE branches, and add the STATIC_ROOT the local branch needs for collectstatic.

This changes production storage behaviordefault returns to api.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.py asserts 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

AssertionError: 'django.contrib.staticfiles.storage.StaticFilesStorage'
            != 'api.custom_storages.StaticStorage'

Docs

Added docs/runbooks/static-assets.md (publishing a static file, the --clear warning, 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 collectstatic from the pod and confirm launch-time.js returns 200 — that is what finally lights up local-time rendering from #322.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

🔍 Quality Check Results

Check Status Result
🔍 Linting success
🧪 Testing success
🔒 Security success

🎉 All quality checks passed! This PR is ready for review.


Triggered by commit 8c1ef51View Details

@ItsCalebJones
ItsCalebJones merged commit 978ea79 into master Aug 12, 2026
10 checks passed
@ItsCalebJones
ItsCalebJones deleted the fix/storages-django5 branch August 12, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant