======================================== Deployment in the production environment ======================================== :Author: Sixu Wei , Zhenyu Yang :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. .. code-block:: text # .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 ===================== .. code-block:: bash # 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 ================================================= .. code-block:: bash # 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 Step 4: Configure HTTPS (optional but recommended) ================================================== Refer to the :doc:`HTTPS Deployment Guide ` for detailed instructions on setting up HTTPS with Nginx. 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``.