This guide will help you migrate your UmpCast application from the deprecated Heroku-20 stack to Heroku-24.
- Python version: Updated from 3.9 to 3.13 (latest)
- Removed:
django-herokupackage (deprecated) - Added:
whitenoisefor static file serving - Added:
dj-database-urlfor database configuration - Updated: Security settings for production
- Updated: All dependencies to latest secure versions
- Django: 3.1.7 → 4.2 LTS (security fixes, stable LTS)
- Requests: 2.25.1 → 2.31+ (security fixes)
- Pillow: 8.1.2 → 10.0+ (performance & security)
- Celery: 5.0.5 → 5.3+ (features & stability)
- Gunicorn: 20.0.4 → 21.0+ (performance)
- psycopg2-binary: 2.8.6 → 2.9+ (Python 3.13 support)
- Node.js version: Updated to 18
- React Scripts: Updated from 3.4.1 to 5.0.1
- Added: Static buildpack configuration
- Heroku Stack: Upgraded from Heroku-20 to Heroku-24 (latest)
- Ubuntu Version: Updated to Ubuntu 22.04 LTS
- Long-term Support: Extended support timeline
First, update your backend dependencies:
cd backend
pipenv installThis will install the new packages and update to Python 3.13.
cd frontend
npm installThis will update to the new React Scripts version.
Before deploying, test your application locally:
Backend:
cd backend
pipenv run python manage.py runserverFrontend:
cd frontend
npm startNote: The deployment process has been updated with monorepo best practices. See the "Complete Migration Workflow" section below for the recommended approach.
- Set the stack to Heroku-24:
heroku stack:set heroku-24 -a umpcastv2-backend-production
heroku stack:set heroku-24 -a umpcastv2-frontend-production- Deploy the backend:
cd backend
git add .
git commit -m "Migrate to Heroku-24"
git push heroku main- Deploy the frontend:
cd frontend
git add .
git commit -m "Migrate to Heroku-24"
git push heroku main- Go to your Heroku dashboard
- Select your app
- Go to Settings tab
- Click "Change stack" and select "Heroku-24"
Since UmpCast uses a monorepo structure with separate backend and frontend apps, here are the recommended deployment practices:
UmpCastV2-Production/
├── backend/ # Django app
├── frontend/ # React app
├── .git/ # Single git repository
└── app.json files # In both directories
Note: If you have GitHub integration enabled (recommended), you don't need Heroku remotes!
Only set up Heroku remotes if you need manual deployment control:
# Add Heroku remotes to your monorepo (only if needed)
git remote add heroku-backend https://git.heroku.com/umpcastv2-backend-production.git
git remote add heroku-frontend https://git.heroku.com/umpcastv2-frontend-production.git
# Verify remotes
git remote -v🎉 With GitHub Integration (Recommended):
# From monorepo root directory - Heroku auto-deploys both apps!
git push origin mainManual Deployment (Only if GitHub integration is disabled):
# Deploy backend
git subtree push --prefix=backend heroku-backend main
# Deploy frontend
git subtree push --prefix=frontend heroku-frontend main- ✅ Deploy from root directory (no cd needed)
- ✅ Single git repository management
- ✅ Clear separation of backend/frontend deployments
- ✅ Easier CI/CD setup
- ✅ Better monorepo practices
- 🚀 Automatic deployment with GitHub integration
- 🎯 Single command deployment:
git push origin main
If you prefer the traditional approach:
# Backend deployment
cd backend
git push heroku main
# Frontend deployment
cd frontend
git push heroku mainNote: The monorepo approach is recommended for better workflow consistency.
Important: UmpCast uses npm, not yarn. Keep these files tracked in Git:
- ✅
package.json- Dependencies and scripts - ✅
package-lock.json- Exact dependency versions (CRITICAL for consistency) - ❌
yarn.lock- Not used (excluded from Git)
Why package-lock.json matters:
- Exact dependency versions - Everyone gets identical packages
- Reproducible builds - Same versions in dev and production
- Faster installs - npm doesn't need to resolve dependencies
- Security consistency - Same vulnerability status across environments
Keep these files tracked in Git:
- ✅
Pipfile- Dependencies and Python version - ✅
Pipfile.lock- Exact dependency versions
Never track these build artifacts:
# Frontend build files
frontend/build/
frontend/dist/
frontend/out/
# Backend static files
backend/staticfiles/
backend/static/
# Dependencies
*/node_modules
frontend/yarn.lock
# Temporary scripts
frontend/fix_*.py
frontend/revert_*.py
backend/update_*.sh# Stage and commit your changes
git add .
git commit -m "Migrate to Heroku-24: Add whitenoise, update dependencies, clean up social OAuth"
# Push to GitHub
git push origin main# Change backend stack
heroku stack:set heroku-24 -a umpcastv2-backend-production
# Change frontend stack
heroku stack:set heroku-24 -a umpcastv2-frontend-production🎉 GitHub Integration Enabled - Deployment is Automatic!
Since you have GitHub integration enabled on both Heroku apps, deployment happens automatically:
# Just push to GitHub - Heroku auto-deploys both apps!
git push origin mainWhat happens automatically:
- ✅ Backend deploys from
backend/subdirectory (PROJECT_PATH: backend) - ✅ Frontend deploys from
frontend/subdirectory (PROJECT_PATH: frontend) - ✅ No manual Heroku commands needed
- ✅ Builds happen automatically on every push to main
Alternative: Manual deployment (not needed with GitHub integration):
# Only if you need manual control
git remote add heroku-backend https://git.heroku.com/umpcastv2-backend-production.git
git remote add heroku-frontend https://git.heroku.com/umpcastv2-frontend-production.git
git push heroku-backend main
git push heroku-frontend mainNote: With GitHub integration, you only need git push origin main!
# Check backend status
heroku logs --tail -a umpcastv2-backend-production
# Check frontend status
heroku logs --tail -a umpcastv2-frontend-productionIssue: Module resolution errors with React
Solution: Ensure "type": "module" is removed from package.json
Issue: Missing react-scripts
Solution: Run npm install to reinstall dependencies
Issue: Profile pictures not loading after migration Solution: Profile pictures are served from S3, not affected by whitenoise migration
Issue: Static files not found
Solution: Ensure python manage.py collectstatic runs during Heroku build
Issue: Mixed npm/yarn artifacts Solution:
- Use only npm (remove yarn.lock)
- Keep package-lock.json in Git
- Exclude node_modules from Git
Issue: Heroku can't find app files
Solution: Use git subtree push --prefix=backend and git subtree push --prefix=frontend
Issue: Wrong buildpack detected Solution: Ensure app.json files are in correct directories
- Heroku Documentation: https://devcenter.heroku.com/
- Django Deployment: https://docs.djangoproject.com/en/4.2/howto/deployment/
- React Build: https://create-react-app.dev/docs/deployment/
- Monorepo Best Practices: https://monorepo.tools/
- Deploy your updated code
After deployment, verify that:
-
Backend is working:
- Check logs:
heroku logs --tail -a your-backend-app-name - Test API endpoints
- Verify database connections
- Check logs:
-
Frontend is working:
- Check logs:
heroku logs --tail -a your-frontend-app-name - Test the application in browser
- Verify static files are serving correctly
- Check logs:
Make sure all your environment variables are still set correctly:
heroku config -a your-backend-app-name
heroku config -a your-frontend-app-nameIf you have any pending migrations:
heroku run python manage.py migrate -a your-backend-app-name-
Build failures:
- Check that all dependencies are properly specified
- Verify Python/Node.js versions are correct
-
Static files not loading:
- Ensure whitenoise is properly configured
- Check STATIC_ROOT and STATIC_URL settings
-
Database connection issues:
- Verify DATABASE_URL is set correctly
- Check that dj-database-url is installed
-
CORS issues:
- Update ALLOWED_HOSTS and CORS_ORIGIN_WHITELIST if needed
If something goes wrong, you can rollback:
heroku rollback -a your-app-name- Security: Latest security patches and updates
- Performance: Improved performance and reliability
- Support: Continued support from Heroku
- Compatibility: Better compatibility with modern packages
- Performance: Up to 5-10% faster than Python 3.11
- Memory Efficiency: Better memory management and reduced memory usage
- New Features: Latest language features and improvements
- Security: Latest security updates and patches
- Future-Proof: Long-term support and compatibility
- Type System: Enhanced type checking and annotations
- Error Handling: Improved error messages and debugging
- Django 4.2 LTS: Latest LTS version with security fixes and long-term support
- Requests 2.31+: Patches for multiple security vulnerabilities
- Pillow 10.0+: Security fixes for image processing
- Updated SSL/TLS: Latest certificate bundles and protocols
- Dependency Scanning: All packages updated to secure versions
- Stability: 4.2 LTS is more stable and battle-tested
- Compatibility: Better compatibility with existing OAuth packages
- Support: Long-term support until April 2026
- Migration Path: Easier migration from Django 3.1.7
- Future-Proof: Can upgrade to Django 5.x later after modernizing authentication
After successful migration:
- Monitor your application for any issues
- Update your CI/CD pipelines if applicable
- You're now on the latest stack with long-term support
If you encounter any issues during migration:
- Check Heroku's official migration guide
- Review the Heroku logs for specific error messages
- Contact Heroku support if needed