fix: 添加 psycopg2-binary 和 gunicorn 到依赖

- 添加 PostgreSQL 驱动 psycopg2-binary
- 添加 gunicorn 生产服务器
This commit is contained in:
maoshen
2026-04-12 21:59:43 +00:00
parent 1716b3ec98
commit 3a01b98860
3 changed files with 6 additions and 4 deletions

View File

@@ -3,3 +3,5 @@ djangorestframework
djangorestframework-simplejwt djangorestframework-simplejwt
django-cors-headers django-cors-headers
Pillow Pillow
psycopg2-binary
gunicorn

View File

@@ -6,7 +6,7 @@ set -e
# 配置 # 配置
SERVER_HOST="cssc.datalibstar.com" SERVER_HOST="cssc.datalibstar.com"
SERVER_USER="mashen" SERVER_USER="ubuntu"
SERVER_PASS="825670@MashenClaw" SERVER_PASS="825670@MashenClaw"
PROJECT_PATH="/root/.openclaw/workspace/city-manual" PROJECT_PATH="/root/.openclaw/workspace/city-manual"

View File

@@ -58,7 +58,7 @@ pip install -r requirements.txt -q
pip install gunicorn -q pip install gunicorn -q
echo "🗄️ 配置环境变量..." echo "🗄️ 配置环境变量..."
cd /home/ubuntu/city-manual cd /home/ubuntu/city-manual/backend
cat > .env << EOF cat > .env << EOF
DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=cssc-secret-key-$(date +%s) DJANGO_SECRET_KEY=cssc-secret-key-$(date +%s)
@@ -70,8 +70,8 @@ STATIC_ROOT=/home/ubuntu/city-manual/backend/static
EOF EOF
echo "📦 数据库迁移..." echo "📦 数据库迁移..."
cd backend cd /home/ubuntu/city-manual/backend
source ../venv/bin/activate source venv/bin/activate
python manage.py migrate --noinput python manage.py migrate --noinput
python manage.py collectstatic --noinput python manage.py collectstatic --noinput