This deployment configuration fixes the following issues:
- ✅ DisallowedHost Error - Wildcard and custom domain support
- ✅ Static Files Not Served - S3-based static file serving
- ✅ Python Version Mismatch - Updated to Python 3.12
- ✅ Serverless Architecture - Proper Vercel Lambda configuration
Go to your Vercel project → Settings → Environment Variables and add:
SECRET_KEY=your-secret-key-here
DEBUG=False
ALLOWED_HOSTS=*
# Or for production security: ALLOWED_HOSTS=events.neopanda.tech,.vercel.appDATABASE_URL=postgresql://postgres.aiwcqroacxepuiquywyl:YOUR_PASSWORD@aws-1-ap-southeast-2.pooler.supabase.com:5432/postgresSTORAGE_BACKEND=s3
AWS_ACCESS_KEY_ID=3b3d99dc6d1a44f39054e646214b73bd
AWS_SECRET_ACCESS_KEY=eee87412c0d147450e030d95d2003e51a409ca0103dedbc376acfd65666bafa3
AWS_STORAGE_BUCKET_NAME=eventhorizon
AWS_S3_ENDPOINT_URL=https://aiwcqroacxepuiquywyl.storage.supabase.co/storage/v1/s3
AWS_S3_REGION_NAME=ap-southeast-2
AWS_S3_USE_SSL=True
AWS_S3_CUSTOM_DOMAIN=aiwcqroacxepuiquywyl.supabase.co/storage/v1/object/public/eventhorizon
# Enable S3 for static files (CRITICAL for Vercel)
USE_S3_FOR_STATIC=TrueEMAIL_BACKEND=smtp
EMAIL_HOST=smtp-pulse.com
EMAIL_PORT=587
# Fix typo: was EMAIL_POSRT
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@domain.com
EMAIL_HOST_PASSWORD=your-password
DEFAULT_FROM_EMAIL=noreply@yourdomain.comTIME_ZONE=Asia/Kolkata
CORS_ALLOW_ALL_ORIGINS=True
ADMIN_URL=/site/management/adminAll necessary changes have been made to:
- ✅
EventHorizon/settings.py- Fixed ALLOWED_HOSTS and S3 static files - ✅
vercel.json- Updated Python version and routes - ✅
build_files.sh- Added S3 environment variables
git add .
git commit -m "Fix Vercel deployment: Add S3 static files support and ALLOWED_HOSTS"
git push origin main- Go to Vercel Dashboard → Your Project
- Settings → Environment Variables
- Add all the variables listed above
- Important: Add them to Production, Preview, and Development environments
Vercel will automatically redeploy when you push, or manually trigger:
- Go to Deployments tab
- Click the three dots on latest deployment
- Click "Redeploy"
-
Build Phase (Vercel):
npm run build:csscompiles Tailwind CSSpython manage.py collectstaticuploads files to Supabase S3- CSS, images, fonts →
s3://eventhorizon/static/
-
Runtime (User requests):
- Browser requests
/static/css/output.css - Django generates URL:
https://supabase.co/.../static/css/output.css - File served directly from S3 (fast, cached)
- Browser requests
- ✅ No filesystem dependencies - Vercel Lambda doesn't need local files
- ✅ Global CDN - Supabase S3 is fast worldwide
- ✅ Production-ready - Same setup works for media files
- ✅ No code in templates - Django's
{% static %}tag still works
After deployment, verify everything works:
# Visit your site
https://events.neopanda.tech
# Should load without "DisallowedHost" error# Open browser DevTools → Network tab
# Reload page and check:
# CSS should load from:
https://aiwcqroacxepuiquywyl.supabase.co/storage/v1/object/public/eventhorizon/static/css/output.css
# Images should load from:
https://aiwcqroacxepuiquywyl.supabase.co/storage/v1/object/public/eventhorizon/static/images/...- Go to Supabase Dashboard → Storage
- Open
eventhorizonbucket - You should see:
media/folder (for uploads)static/folder (for CSS, JS, images)
- ✅ Homepage loads with styling
- ✅ Images display correctly
- ✅ Login/Register forms work
- ✅ Admin panel accessible at
/site/management/admin - ✅ File uploads work (avatars, etc.)
Check 1: Verify S3 bucket permissions
# Supabase Dashboard → Storage → eventhorizon bucket
# Policies → Make sure "public" read access is enabledCheck 2: Verify environment variables
# Vercel Dashboard → Settings → Environment Variables
# Ensure USE_S3_FOR_STATIC=True is set for ProductionCheck 3: Check build logs
# Vercel Dashboard → Deployments → Latest → Build Logs
# Look for: "Collecting static files to S3..."
# Should see successful uploadsSolution: Check environment variable format
# WRONG (with quotes):
ALLOWED_HOSTS="*"
# CORRECT (no quotes):
ALLOWED_HOSTS=*
# Or explicit:
ALLOWED_HOSTS=events.neopanda.tech,.vercel.appCheck: Fix typo in environment variable
# WRONG:
EMAIL_POSRT=587
# CORRECT:
EMAIL_PORT=587Your local .env file contains real credentials:
- ❌ Database password
- ❌ Email password
- ❌ S3 credentials
- ❌ Secret keys
URGENT: Verify .env is in .gitignore and never committed!
- Change
ALLOWED_HOSTS=*to specific domains - Rotate
SECRET_KEYif ever committed to git - Use Vercel environment variables, not
.envfile - Enable 2FA on Supabase and Vercel accounts
- Monitor Supabase storage usage
| Metric | Before (Broken) | After (S3) |
|---|---|---|
| Static files | ❌ 404 errors | ✅ Served from S3 |
| Load time | N/A (broken) | ~200-300ms |
| CDN | None | Supabase global CDN |
| Caching | None | HTTP caching headers |
| Cost | Free | Free (Supabase free tier) |
User → Server (Gunicorn) → Django → WhiteNoise → Static Files
→ Database
→ S3 (media only)
User → Vercel CDN → Lambda (Django) → Database
↓
S3 (static + media)
Key Difference: Vercel Lambda has no persistent filesystem, so ALL files must come from S3.
- ✅ Deploy with the fixed configuration
- ✅ Verify static files load from S3
- ✅ Test all site functionality
- Change
ALLOWED_HOSTS=*to explicit domains - Fix
EMAIL_PORTtypo in Vercel env vars - Set up custom domain properly with DNS
- Enable Vercel Analytics for monitoring
- Consider migrating to Railway/Render for better Django support
- Set up Sentry for error tracking
- Configure Vercel CDN caching rules
- Implement CSP headers for security
If you encounter continued issues with Vercel, Railway is much better for Django:
- ✅ Django works out-of-the-box (no S3 needed for static files)
- ✅ WhiteNoise handles static files efficiently
- ✅ No cold starts
- ✅ WebSockets support
- ✅ Background tasks work
- ✅ Easier debugging
- ✅ Similar pricing ($5-10/month)
- 5-10 minutes (your
Procfileandgunicorn_config.pyalready exist)
If you encounter issues:
- Check Vercel deployment logs
- Check Supabase storage bucket
- Verify all environment variables are set correctly
- Check browser console for 404 errors on static files
Last Updated: December 21, 2025 Status: ✅ Ready for deployment