-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (24 loc) · 775 Bytes
/
app.py
File metadata and controls
32 lines (24 loc) · 775 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
from flask import Flask, send_from_directory
from flask_cors import CORS
import os
from modules.parent_preprocessor import parent_preprocessor
app = Flask(__name__,
static_folder = "./dist/static",
template_folder = "./dist")
#Enable CORS
CORS(app, resources={r'/*': {'origins': '*'}})
#Create file storage location if doesn't exist
app.config['UPLOAD_FOLDER'] = 'files'
if not os.path.exists(app.config['UPLOAD_FOLDER']):
os.makedirs(app.config['UPLOAD_FOLDER'])
#Routes
@app.route('/')
def home(path='index.html'):
return send_from_directory('dist', path)
@app.route('/health', methods=['GET'])
def health():
return "Serve is running"
#Modules
app.register_blueprint(parent_preprocessor)
if __name__ == '__main__':
app.run()