HerokuEd MorleyTutorial
From Project to Productionized with Python
Summary
The post presents a hands-on tutorial for Python developers moving a local Django application into production on Heroku. It frames the work around 12-factor practices and covers repository hygiene, modular settings, continuous delivery stages, static-asset middleware, environment configuration, database provisioning, deployment, scaling, and troubleshooting. The configuration changes include excluding virtual environments, caches, SQLite data, and generated static files; moving settings.py to settings/base.py; updating DJANGO_SETTINGS_MODULE; adding Whitenoise; and supplying SECRET_KEY and a Heroku Postgres add-on. The deployment uses Git, the Heroku CLI, git push heroku main, and heroku ps:scale web=1, with heroku logs --tail and heroku run bash for diagnosis. The walkthrough concludes with the app deployed and accessible through heroku open.
Context
The tutorial addresses the process of taking a local Django application and preparing it for production deployment on Heroku, including the configuration and operational practices associated with a 12-factor application.
Approach / What changed
It updates project files and settings, separates configuration into a base settings module, adds middleware and deployment configuration, provisions Heroku Postgres, pushes the application with Git, scales its web process, and provides CLI-based logging and remote-console troubleshooting.
Takeaways
The Django settings are split by moving settings.py to settings/base.py and updating manage.py and wsgi.py to use gettingstarted.settings.base.
The deployment provisions Postgres with heroku addons:create heroku-postgresql:hobby-dev instead of relying on the local SQLite database.
After git push heroku main, the web process is scaled with heroku ps:scale web=1; heroku logs --tail and heroku run bash support troubleshooting.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.