-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py~
39 lines (28 loc) · 882 Bytes
/
app.py~
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
37
38
39
from flask import Flask, request
from api.tools.entities.clear import clear as clear_db
from api.tools.entities.status import status as status_db
import json
app = Flask(__name__)
app.config['DEBUG'] = True
from api.thread import module as thread
from api.user import module as user
from api.forum import module as forum
from api.post import module as post
app.register_blueprint(user)
app.register_blueprint(forum)
app.register_blueprint(thread)
app.register_blueprint(post)
@app.before_request
def before_request():
print request
print request.endpoint
@app.route('/db/api/clear/', methods=['POST'])
def clear():
clear_db()
return json.dumps({"code": 0, "response": "OK"})
@app.route('/db/api/status/', methods=['GET'])
def status():
status_db()
return json.dumps({"code": 0, "response": "OK"})
if __name__ == '__main__':
app.run(port=5000)