mirror of
https://github.com/zhtyyx/ioe.git
synced 2026-06-03 21:02:59 +08:00
2.2 KiB
2.2 KiB
Docker Deployment Guide
This document provides detailed instructions for deploying this application using Docker.
Prerequisites
- Install Docker
- Install Docker Compose
Development Environment Deployment
- Clone the repository
git clone <repository-url>
cd ioe
- Create environment variable file
cp .env.template .env
# Edit the .env file and fill in the correct configuration information
- Build and start containers
docker-compose up --build
- Access the application
Open your browser and visit http://localhost:8000
Production Environment Deployment
- Clone the repository
git clone <repository-url>
cd ioe
- Create environment variable file
cp .env.template .env
# Edit the .env file and fill in the correct configuration information, especially SECRET_KEY and ALLOWED_HOSTS
- Start containers with production configuration
docker-compose -f docker-compose.prod.yml up -d
- Create a superuser (if needed)
docker-compose -f docker-compose.prod.yml exec web python manage.py createsuperuser
Data Persistence
In the production environment, data is stored in Docker volumes:
static_volume: Static filesmedia_volume: Media files (such as uploaded images)db_volume: Database files
Common Commands
- View logs:
docker-compose logs -f - Stop services:
docker-compose down - Restart services:
docker-compose restart - Execute Django management commands:
docker-compose exec web python manage.py <command>
Custom Configuration
To customize Docker configuration, you can edit the following files:
Dockerfile: Modify the application environmentdocker-compose.yml: Modify development environment service configurationdocker-compose.prod.yml: Modify production environment service configuration
Important Notes
- In the production environment, make sure to set a secure SECRET_KEY
- Update ALLOWED_HOSTS to include your domain name
- Consider using an external database service (such as PostgreSQL) instead of SQLite for better performance
- Regularly backup data in volumes