-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.py
More file actions
36 lines (27 loc) · 920 Bytes
/
server.py
File metadata and controls
36 lines (27 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from flask import Flask
from lib.node import Node
from node.root import Root
app = Flask(__name__)
app.config.from_pyfile('config.py')
root = Node(Root)
@app.route('/root/<path:sub_path>', methods=['POST', 'GET'])
def mail(sub_path):
args = sub_path.split('/')
return root.action(*args)
if __name__ == '__main__':
app.run(host=app.config['HOST'],
port=app.config['PORT'],
debug=app.config['DEBUG'])
# 解决部分端口不能作为http端口
# sudo semanage port -l | grep http_port_t
# sudo semanage port -a -t http_port_t -p tcp 8024
# setsebool -P httpd_can_network_connect 1
# 生产环境部署
# nohup /venvs/flask/bin/uwsgi --socket 0.0.0.0:8000 --protocol=http -w server:app &
# 邮箱配置
# export SECURITY_EMAIL_SENDER='545641826@qq.com'
# 常用命令
# export py=/venvs/flask/bin/
# cd /projects/flask/
# ${py}python wsgi.py
# http://192.168.169.16:8000/root/