Skip to main content
Deploy Django with Gunicorn on ECS Fargate behind an Application Load Balancer.

Prerequisites

  • A Git repository containing your application and its production build command.
  • A Ravion account with your AWS account connected. Start free at Ravion signup.
  • The Ravion CLI installed and authenticated. See CLI installation.
The examples use my-org/my-app as a placeholder. Replace it with your repository before applying the config.

Set up this Django app for Ravion ECS hosting.

Open in Cursor

Configure the deployment

Django’s production documentation recommends a WSGI server instead of runserver. This example uses Railpack for the build. Use build_source: dockerfile instead when you need a custom Dockerfile. Railpack detects Django from the application files and dependencies. Railpack detects Django from its dependencies or manage.py. Its default start command runs python manage.py migrate and then Gunicorn with the detected application module. Migrations run on every boot by default, which can race when multiple ECS tasks start; move migrations to a separate release step for multi-task deployments. Set RAILPACK_DJANGO_APP_NAME when the WSGI module is not the detected default. Ravion injects PORT automatically from container_port.
ravion.yaml
Run migrations as a deployment step, set ALLOWED_HOSTS and SECRET_KEY as runtime values, and use DATABASE_URL for your database connection. Populate that secret from the RDS outputs before applying the service.

Apply and connect your domain

Follow custom domains to connect your domain to the Application Load Balancer.

Next steps

Custom domains

Point a domain at your deployed service and manage its certificate.

Project config

Preview and apply Ravion configuration from source control.

Pipelines

Add approvals, migrations, and deployment automation.

Logs and metrics

Inspect deploy output and production health in Ravion.