generated from dellevin/template
"移除 server/ 目录,加入 .gitignore"
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
# MookNote 用户统计服务
|
||||
|
||||
## 部署
|
||||
|
||||
### 1. 安装依赖
|
||||
|
||||
```bash
|
||||
cd server
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### 2. 启动服务
|
||||
|
||||
```bash
|
||||
python app.py
|
||||
```
|
||||
|
||||
默认监听 `0.0.0.0:5000`,可通过环境变量 `PORT` 修改端口。
|
||||
|
||||
### 3. 生产环境部署
|
||||
|
||||
推荐使用 gunicorn:
|
||||
|
||||
```bash
|
||||
pip install gunicorn
|
||||
gunicorn -w 2 -b 0.0.0.0:5000 app:app
|
||||
```
|
||||
|
||||
或使用 systemd 设为开机自启。
|
||||
@@ -1,29 +0,0 @@
|
||||
"""MookNote 服务端 - 入口"""
|
||||
import os
|
||||
from flask import Flask
|
||||
from config import JWT_SECRET
|
||||
from database import init_db
|
||||
from auth import register_auth_routes
|
||||
from admin_api import register_admin_routes
|
||||
from sync_api import register_sync_routes
|
||||
from data_api import register_data_routes
|
||||
from web_ui import register_web_routes
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config["SECRET_KEY"] = JWT_SECRET
|
||||
|
||||
# 初始化数据库
|
||||
init_db()
|
||||
|
||||
# 注册所有路由模块
|
||||
register_auth_routes(app)
|
||||
register_admin_routes(app)
|
||||
register_sync_routes(app)
|
||||
register_data_routes(app)
|
||||
register_web_routes(app)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from waitress import serve
|
||||
port = int(os.environ.get("PORT", 5000))
|
||||
print(f"MookNote 服务端启动于 http://0.0.0.0:{port}")
|
||||
serve(app, host="0.0.0.0", port=port)
|
||||
@@ -1,3 +0,0 @@
|
||||
flask==3.1.0
|
||||
pyjwt==2.8.0
|
||||
waitress==3.0.0
|
||||
BIN
server/stats.db
BIN
server/stats.db
Binary file not shown.
Reference in New Issue
Block a user