This project is a website based on Flask and BootstrapVue that separates the front and back ends of the Hangzhou Electric Brush Questions ranking list.
Operating system: either Windows or Linux. python3.x pip3 MySQL8.x
## Install the required PIP library
pip3 install flask pymysql requests flask_cors
## Domestic users can use to add pip install time parameters, such as:
pip3 install -i https://mirrors.ustc.edu.cn/pypi/web/simple/ flask pymysql requests flask_cors
## Cloning project
git clone https://github.com/736248591/hdu_rank.git
## Into the project
cd hdu_rank
## run Setup Assistant
python3 helper.py
## Start crawling process
python3 hdu_crawl.py &
Note: Choose one of the following methods
Note that Tornado cannot run in multiple processes under Windows.
## Note: Make sure to compile and install Python before installing a libffi-devel, or else be wrong here pip3 install.
## Install the required PIP library
pip3 install tornado
## Domestic users can replace the above command with the following command
pip3 install -i https://mirrors.ustc.edu.cn/pypi/web/simple/ tornado
cd hdu_rank
## start Tornado
python3 run_tornado.py
## Note: Make sure to compile and install Python before installing a libffi-devel, or else be wrong here pip3 install.
## Install the required PIP library
pip3 install uWSGI
## Increase of user and group hdurank
/usr/sbin/groupadd hdurank
/usr/sbin/useradd -g hdurank hdurank
## Create a Domain Name
lnmp vhost add
## Follow the prompts to fill in your name and address local storage project. Note that the root directory of the website is filled in hdu_rank/static
## Edit configuration NGINX
vim /usr/local/nginx/conf/vhost/your domain name.conf
## Add the following at the same level of child location of the server.
location ~ * /api/{
include uwsgi_params ;
uwsgi_pass 127.0.0.1:5007 ;
}
## Restart nginx server
lnmp nginx reload
## Open a new screen, so after turning off the terminal program will not be closed
screen -R hdu_rank
## Start uwsgi server
uwsgi --ini uwsgi.ini
These methods can be viewed in the official Chinese document of Flask , which will not be repeated here.
Parameters: (None) Response data:
{
status: 操作状态 Boolean,
notice: 公告 string,
crawl_status: 爬虫状态 union("runnable","running","sleeping","stopped")
users: 用户列表(当状态为True时,拥有这个字段)
[
{
id: 用户ID unsigned int,
uid 登录账号 string,
class_name 班级 string,
name 姓名 string,
motto 格言 string,
account 账号 string,
solved_num 题数 int,
status 状态 union("unchecked","fetching","active","disconnect")
}
],
user:{
id 用户ID unsigned int,
uid 登录账号 string,
class 班级 string,
name 姓名 string,
motto 格言 string,
account 账号 string,
solved_num 题数 int,
status 状态 union("unchecked","fetching","active"),
html 自定义页面代码 string
},
admin:{
id: 管理员ID int,
uid: 管理员 string,
is_super: 是否可以管理其他用户 bool,
}
}
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string,
// 当登录成功时候显示以下信息
user:{
id 用户ID unsigned int,
uid 登录账号 string,
class 班级 string,
name 姓名 string,
motto 格言 string,
account 账号 string,
solved_num 题数 int,
status 状态 union("unchecked","fetching","active"),
html 自定义页面代码 string
},
admin:{
id: 管理员ID int,
uid: 管理员 string,
is_super: 是否可以管理其他用户 bool,
}
}
Note: When modifying, you only need to submit the ID and modified fields. When adding users, no id is required. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Description: Used to verify the fields when registering. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Parameters: (None) Response data:
{
status: 操作状态 Boolean
}
Note: You must log in before you can use this interface. Users can only delete themselves, and only the administrator can delete any user. parameter:
Field nametype of dataDefaultsdescriptionidunsigned intUser IDResponse data:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Note: If you do not fill in any information, the current login information will be returned. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string,
admin:{
id: 管理员ID int,
uid: 管理员 string,
is_super: 是否可以管理其他用户 bool,
}
}
Parameters: (None) Response data:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string,
admins:[
{
id: 管理员ID int,
uid: 管理员登录账号 int,
is_super: 是否可以管理其他管理员 bool
}
]
}
Description: Used to verify fields when adding an administrator. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Note: When modifying, you only need to submit the ID and modified fields. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string,
}
Note: You must log in before you can use this interface. Only super administrators can delete other administrators. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Note: Only the administrator can use this interface. Parameters: (None) Response data:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Note: Only the administrator can use this interface. Parameters: (None) Response data:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Note: Only the administrator can use this interface. parameter:
{
status: 操作状态 Boolean,
mgs: 错误原因 (当状态为false时,拥有这个字段)string
}
Install Node.js and Yarn
cd hdu_rank
yarn global add @vue/cli
yarn install
yarn build
Update dependencies
Update dependencies and recompile the client.
Modify the uwsgi server configuration.
Fixed some problems with crawler connection.
Upgraded the version of the dependent package to solve the security risks.
Fixed the BUG of database file import.
Added the dependencies required by python3.7 in the documentation.
The administrator password was not created incorrectly.
Added website icon and title.
1.0 Initial release
Author: 736248591
Source Code: https://github.com/736248591/hdu_rank
#vuejs #vue #javascript