-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
37 lines (26 loc) · 690 Bytes
/
app.py
File metadata and controls
37 lines (26 loc) · 690 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
37
import config
from flask import Flask, jsonify, send_from_directory
from flask_cors import CORS
app = Flask(__name__)
app.config["SECRET_KEY"] = config.flask_secret_key
CORS(app)
from views.admin import *
from views.api import *
@app.errorhandler(404)
def page_not_found(e):
return jsonify({
"error": "API endpoint not found"
}), 404
@app.errorhandler(500)
@app.errorhandler(405)
def internal_server_error(e):
return jsonify({
"error": "Internal server error"
}), 500
@app.errorhandler(413)
def request_entity_too_large(e):
return jsonify({
"error": "To large (max. 1 MB)"
}), 413
if __name__ == "__main__":
app.run(debug=True)