126 lines
6.0 KiB
Markdown
126 lines
6.0 KiB
Markdown
# Technology Stack
|
|
|
|
**Analysis Date:** 2026-05-07
|
|
|
|
## Languages
|
|
|
|
**Primary:**
|
|
- Python 3.8 - Entire backend application (specified in `Dockerfile` line 2)
|
|
|
|
## Runtime
|
|
|
|
**Environment:**
|
|
- Python 3.8 via Docker container (docker.m.daocloud.io/python:3.8)
|
|
- ASGI server: Daphne for WebSocket + HTTP support (see `run.sh`)
|
|
|
|
**Package Manager:**
|
|
- pip 3.8+ (Python package manager)
|
|
- Lockfile: No pinned versions in `requirements.txt` (line 1-42) — dependencies are unpinned, allowing flexibility but risking compatibility issues
|
|
|
|
## Frameworks
|
|
|
|
**Core:**
|
|
- Django 4.2.13 - Primary web framework (declared in `qy_lty/settings.py:4`)
|
|
- Django REST Framework (DRF) - REST API implementation (in `requirements.txt`)
|
|
- Django Channels - WebSocket support for real-time device communication (in `requirements.txt`, configured in `qy_lty/settings.py:501`)
|
|
|
|
**Real-Time & Async:**
|
|
- Daphne - ASGI server to serve both HTTP and WebSocket (in `requirements.txt`, launched via `run.sh`)
|
|
- channels-redis - Channel layer using Redis for inter-process messaging (in `requirements.txt`, configured at `qy_lty/settings.py:504-511`)
|
|
- aioredis - Async Redis client (in `requirements.txt`)
|
|
|
|
**API Documentation:**
|
|
- drf-yasg - Generates Swagger/OpenAPI documentation for DRF (in `requirements.txt`, configured at `qy_lty/settings.py:513-549`)
|
|
|
|
**Database & Caching:**
|
|
- PostgreSQL - Primary relational database (configured at `qy_lty/settings.py:166-172`)
|
|
- Redis - Cache backend and WebSocket channel layer (configured at `qy_lty/settings.py:252-260` for cache, `504-511` for channels)
|
|
- Client: django-redis for Django integration (in `requirements.txt`)
|
|
- Password-authenticated via environment variables
|
|
|
|
**Admin & UI:**
|
|
- django-simpleui - Enhanced admin interface with Chinese localization (in `requirements.txt`, configured at `qy_lty/settings.py:475-498`)
|
|
- django-rosetta - Translation management UI (in `requirements.txt`)
|
|
|
|
**Authentication & Authorization:**
|
|
- django-allauth - Social authentication framework including WeChat provider (in `requirements.txt`, configured at `qy_lty/settings.py:52-56`, backend at `qy_lty/settings.py:321-325`)
|
|
- dj_rest_auth - Token-based REST authentication bridge (in `requirements.txt`)
|
|
- django-phone-verify - Phone verification support (in `requirements.txt`)
|
|
- Custom: `userapp.authentication.RedisTokenAuthentication` - Token stored in Redis with 30-day TTL (see `CLAUDE.md` line 122)
|
|
|
|
**Development & Debugging:**
|
|
- django-debug-toolbar - Development-time debugging (in `requirements.txt`)
|
|
- django-cors-headers - CORS middleware for cross-origin requests (in `requirements.txt`, middleware at `qy_lty/settings.py:85`)
|
|
|
|
**Task Scheduling:**
|
|
- APScheduler (apscheduler) - Background task scheduling (in `requirements.txt`)
|
|
|
|
**File Storage & Image Processing:**
|
|
- Pillow - Image processing library (in `requirements.txt`)
|
|
- oss2 - Aliyun OSS Python SDK for file uploads (in `requirements.txt`, used in `common/oss.py`)
|
|
|
|
**Data Export & Processing:**
|
|
- openpyxl - Excel file generation (in `requirements.txt`)
|
|
|
|
**Utilities:**
|
|
- requests - HTTP client for external API calls (in `requirements.txt`, used throughout for service integrations)
|
|
- cryptography - Encryption/decryption utilities (in `requirements.txt`)
|
|
- python-decouple - Environment variable loading (in `requirements.txt`, used at `qy_lty/settings.py:14`)
|
|
- openai - OpenAI Python SDK for Kimi API (compatible with OpenAI spec, in `requirements.txt`)
|
|
|
|
## Key Dependencies
|
|
|
|
**Critical Infrastructure:**
|
|
- mysqlclient - MySQL database adapter (in `requirements.txt`, though PostgreSQL is primary; MySQL config commented at `qy_lty/settings.py:159-164`)
|
|
- psycopg2-binary - PostgreSQL database adapter (in `requirements.txt`, active at `qy_lty/settings.py:166`)
|
|
|
|
**Aliyun (Alibaba Cloud) SDKs:**
|
|
- aliyun-python-sdk-core - Core SDK for Aliyun services (in `requirements.txt`)
|
|
- aliyun-python-sdk-dysmsapi - SMS service SDK (in `requirements.txt`, configured at `qy_lty/settings.py:300-304`)
|
|
- oss2 - OSS (Object Storage Service) SDK (in `requirements.txt`, integrated at `common/oss.py:1-90`)
|
|
- alibabacloud_facebody20191230 - Face detection/recognition service (in `requirements.txt`)
|
|
- alibabacloud_tea_console, alibabacloud_tea_util, alibabacloud_tea_openapi - Aliyun SDK utilities (in `requirements.txt`)
|
|
- aliyun-log-python-sdk - Logging service SDK (in `requirements.txt`, used at `common/aliyun_logging.py:1-36`)
|
|
|
|
**AI & LLM:**
|
|
- openai - OpenAI Python client, used for Kimi (OpenAI-compatible API) at `aiapp/kimi.py:2` (configured at `qy_lty/settings.py:349-350`)
|
|
|
|
## Configuration
|
|
|
|
**Environment:**
|
|
- Loaded via `python-decouple.config()` from `.env` file (see `qy_lty/settings.py:14`)
|
|
- Critical env vars required:
|
|
- `SECRET_KEY` - Django secret key
|
|
- `DEBUG` - Debug mode flag
|
|
- `POSTGRESQL_DATABASE_NAME`, `POSTGRESQL_DATABASE_USER`, `POSTGRESQL_DATABASE_PASSWORD`, `POSTGRESQL_DATABASE_HOST`, `POSTGRESQL_DATABASE_PORT` - PostgreSQL connection
|
|
- `REDIS_LOCATION`, `REDIS_PASSWORD` - Redis cache and channel layer
|
|
- `KIMI_API_KEY`, `KIMI_BASE_URL` - Kimi AI configuration
|
|
- `ALIYUN_*` family - SMS, OSS, NLS, VI, logging credentials
|
|
- `VOLCENGINE_ACCESS_KEY`, `VOLCENGINE_SECRET_KEY` - RTC service credentials
|
|
- Audio service provider env vars (AUDIO_SERVICE_HUOSHAN_*, AUDIO_SERVICE_TENCENT_*)
|
|
|
|
**Build:**
|
|
- `Dockerfile` - Docker image definition (lines 1-33), uses Python 3.8 with China mirror for pip
|
|
- `docker-compose.yml` - Service orchestration (lines 1-33), exposes port 12012 → 8000
|
|
- `run.sh` - Local development entrypoint (lines 1-2), launches Daphne on 0.0.0.0:8000
|
|
|
|
## Platform Requirements
|
|
|
|
**Development:**
|
|
- Python 3.8+
|
|
- pip for dependency installation
|
|
- PostgreSQL database server (or MySQL as fallback)
|
|
- Redis server for cache + channel layer
|
|
- Docker & docker-compose for containerized development
|
|
|
|
**Production:**
|
|
- Docker container (see `Dockerfile` and `docker-compose.yml`)
|
|
- External PostgreSQL service
|
|
- External Redis service
|
|
- HTTPS reverse proxy (e.g., Nginx) recommended for production
|
|
- Deployment target: Linux/Docker (accessible via port 12012 in example)
|
|
|
|
---
|
|
|
|
*Stack analysis: 2026-05-07*
|