Files
diary-system/add_first_experience_cloud.py
maoshen b273789ae8 Initial commit: 日记系统
完整的日记记录系统
- Django 后端 (diary app)
- 前端页面
- 部署脚本 (本地 + 云端)
- Nginx 配置
- 数据迁移和同步工具
2026-04-14 10:07:27 +00:00

24 lines
992 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""添加第一条经验总结 - 云服务器版"""
import os
import sys
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'diary_system.settings')
sys.path.insert(0, '/home/ubuntu/diary-system/backend')
import django
django.setup()
from diary.models import Experience
# 创建第一条经验总结
exp = Experience.objects.create(
title="云服务器 Gunicorn 路径问题",
category="deployment",
problem="Gunicorn systemd 服务启动失败错误Failed to locate executable /usr/bin/gunicorn",
solution="1. 使用 pip3 install gunicorn 安装\n2. 查找 gunicorn 实际路径:/home/ubuntu/.local/bin/gunicorn\n3. 修改 systemd 服务文件,添加 Environment=PATH 并更新 ExecStart 路径",
lesson_learned="在云服务器上使用 pip 安装的包可能在用户目录,需要确认实际路径并在 systemd 中正确配置"
)
print(f"✅ 经验总结已创建:{exp.title}")
print(f" 类别:{exp.get_category_display()}")