fix(start): allow skipping collectstatic via DISABLE_COLLECTSTATIC env var#1237
fix(start): allow skipping collectstatic via DISABLE_COLLECTSTATIC env var#1237
Conversation
✅ Deploy Preview for antenna-preview canceled.
|
✅ Deploy Preview for antenna-ssec canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe production Django startup script now includes conditional logic to optionally skip the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds an opt-in toggle to the production Django container start script so deployments that don’t need Django static collection (or have an unreachable staticfiles backend) can avoid blocking container boot.
Changes:
- Gate
python /app/manage.py collectstatic --noinputbehindDISABLE_COLLECTSTATIC=1. - Log an explicit “Skipping collectstatic …” message when the skip is enabled.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…v var Deployments that serve static files from an external CDN (e.g. Netlify) do not need Django's `collectstatic` to run on container boot. When the configured `STATICFILES_STORAGE` backend is unreachable, `collectstatic` can hang indefinitely on a network call, blocking gunicorn from starting and causing 502 Bad Gateway responses upstream until the container is killed and recreated. This adds an opt-in env var (`DISABLE_COLLECTSTATIC=1`) that skips the step entirely in `compose/production/django/start`. Default behaviour (running `collectstatic`) is unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2ea6791 to
3cbd9b1
Compare
Summary
Adds an opt-in env var (
DISABLE_COLLECTSTATIC=1) to skipcollectstaticincompose/production/django/start. Default behaviour is unchanged.Why
Deployments that serve static files from an external CDN (e.g. Netlify) do not need Django's
collectstaticto run on container boot. When the configuredSTATICFILES_STORAGEbackend is unreachable,collectstaticcan hang indefinitely on a network call. Because/startrunscollectstaticbeforeexec gunicorn, this blocks gunicorn from ever starting and the container appears "up" but nothing listens on port 5000 — producing 502 Bad Gateway responses upstream until the container is killed and recreated.This was observed in a production deployment after a routine container restart. The container had been running fine for weeks because the previous image had a local modification commenting out the
collectstaticline; that modification was lost on the next image rebuild andcollectstaticran against an unreachable backend, hanging at boot.Behaviour
DISABLE_COLLECTSTATICunset or set to anything other than"1"→ unchanged,collectstaticruns as before.DISABLE_COLLECTSTATIC=1→ printsSkipping collectstatic (DISABLE_COLLECTSTATIC=1)and proceeds straight to gunicorn.Test plan
DISABLE_COLLECTSTATICunset → confirmcollectstaticstill runs (existing behaviour).DISABLE_COLLECTSTATIC=1→ confirm the skip message logs and gunicorn starts.startscripts; local development behaviour unchanged.🤖 Generated with Claude Code
Summary by CodeRabbit