Andromeda
Note

Production Deployment

Definition

The process of moving a web application from a local development environment to a live, internet-accessible server (e.g., Heroku), and hardening it for public access.

Why It Matters

Deployment is the moment of truth for any software project. Hardening an application for the “hostile wilderness” of the internet is the only way to ensure that your work remains functional, secure, and available to the world.

Core Concepts

  • Virtual Environments: Isolating project dependencies to ensure the production environment matches development.
  • DEBUG = False: The most critical security setting. Disables detailed error pages that could leak sensitive system information to attackers.
  • Environment Variables: Using os.environ to store sensitive data (API keys, SECRET_KEY, database passwords) outside of the codebase.
import os

# Securely retrieving sensitive configuration
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
DB_PASSWORD = os.environ.get('DATABASE_PASSWORD')
DEBUG = os.environ.get('DEBUG', 'False') == 'True'
  • Static Assets: Using tools like Bootstrap for responsive UI and django-heroku to manage static file delivery in production.
  • Version Control (Git): Tracking changes and acting as the pipeline for deployment (e.g., git push heroku master).

Connected Concepts