开始安装 - ZnPdCo/rating-system GitHub Wiki
环境准备
要安装评级系统,您的系统上需要安装 Python 3.10 或更高版本。你可以从官方网站下载 Python:https://www.python.org/downloads/。
您还需要安装 Node.js 18.20 或更高版本。你可以从官方网站下载 Node.js:https://nodejs.org/en/download/。
您还需要安装 MySQL 5.7 或更高版本。你可以从官方网站下载 MySQL:https://dev.mysql.com/downloads/mysql/。并将 MySQL 添加到系统环境变量。
安装 Rating System
-
克隆项目仓库:
git clone https://github.com/ZnPdCo/rating-system.git cd rating-system
-
配置数据库:
- 打开 MySQL 并创建名为
rating_system
的数据库:
CREATE DATABASE rating_system;
- 将数据库信息录入到
backend/app/config.py
中:
"db_host": "localhost", "db_port": 3306, "db_user": "root", "db_password": "123456", "db_name": "rating_system",
- 打开 MySQL 并创建名为
-
下载依赖包:
cd frontend npm install cd .. cd backend pip install -r requirements.txt npm install cd .. pip install gunicorn
-
修改代码以实现帐户验证、自动获取通过状态和自动拉取问题(可选):
或者从 适配器仓库 中选择合适的适配器进行安装。
-
构建前端代码:
cd frontend npm run build cd ..
-
运行服务
如果要在开发模式下运行服务器,请运行(请不要在生产环境下使用):
cd backend flask run # flask run -h 0.0.0.0 -p 80
如果你想在生产模式下运行服务器,请使用像 Gunicorn 这样的 WSGI 服务器:
cd backend gunicorn -w 4 -b 0.0.0.0:5000 app:app
配置
您可以修改配置文件 backend/app/config.py
来定制评级系统。