This project implements a train ticket management web system with user-side booking workflows and admin-side management workflows.
Main capabilities:
- User register/login/logout
- Ticket search and booking
- Order change and refund
- Admin management for users, trains, stations, and orders
- MySQL persistence with SQL backup restore
| Module | Capability | Description |
|---|---|---|
| Auth | Register / Login / Logout | Django session-based auth |
| Search | Route and seat query | Fast booking after query |
| Orders | Buy / Change / Refund | Full order lifecycle |
| Admin | CRUD for core resources | Separate admin entry |
| Data | MySQL + SQL backup | Includes ticket_system.sql |
| Audit | Logs and anti-bruteforce | Operation and login records |
flowchart LR
A[User Pages] --> B[Django Views]
B --> C[Business Logic]
C --> D[(MySQL)]
E[Admin Pages] --> B
D --> F[Users/Trains/Stations/Orders]
C --> G[Operation & Security Logs]
.
├─ 01实验报告/
├─ 02源代码/ # Main source code
├─ 03数据库备份文件/ # SQL backup
├─ 04可执行程序/
├─ 05演示视频/
├─ assets/
├─ README.md
└─ README_EN.md
cd "02源代码"
pip install -r requirements.txtSet DB env vars (PowerShell):
$env:DB_NAME="ticket_system"
$env:DB_USER="root"
$env:DB_PASSWORD="your_password"
$env:DB_HOST="localhost"
$env:DB_PORT="3306"Run:
python manage.py makemigrations
python manage.py migrate
python manage.py runserverCreate admin account:
python create_manager.py- User home:
http://127.0.0.1:8000/ - Admin login:
http://127.0.0.1:8000/manager/login/
mysql -u root -p ticket_system < "03数据库备份文件/ticket_system.sql"MIT License. See LICENSE.