Deployment in the production environment

Author:

Sixu Wei <reisa@sust.edu.cn>, Zhenyu Yang <yangzhenyu@sust.edu.cn>

Last updated:

Jan 24, 2026

This document provides a step-by-step guide for deploying the project in a production environment. In production, Nginx is used as the reverse proxy, and Gunicorn runs the backend application.

Step 1: Configure environment variables

Based on prod.env, create a .env file in the project root directory.

# .env
MYSQL_ROOT_PASSWORD=your_secure_password_here        # Database password
DJANGO_SECRET_KEY=your-very-long-random-secret-key   # Django secret key (at least 50 characters)
DOMAIN=example.com                                   # Your domain (optional)

Step 2: Build and run

# Build and run
sudo docker compose -f docker-compose.prod.yml up --build -d

# Check service status
sudo docker compose -f docker-compose.prod.yml ps

# View logs (if any issues occur)
sudo docker compose -f docker-compose.prod.yml logs -f

Step 3: Initialize the database and create a user

# Run database migrations
sudo docker compose -f docker-compose.prod.yml exec backend python manage.py migrate

# Create an administrator account
sudo docker compose -f docker-compose.prod.yml exec backend python manage.py createsuperuser

Production access endpoints

Service

URL

Frontend

http://localhost

Backend API

http://localhost/api/

Admin Panel

http://localhost/admin/

Domestic (China) image mirror configuration

If image pulls fail, configure a Docker mirror registry in your Dockerfile.