-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
42 lines (31 loc) · 1.04 KB
/
app.py
File metadata and controls
42 lines (31 loc) · 1.04 KB
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
40
41
42
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from src.config import *
from src.utils.constants import METRIC
app = Flask(__name__, template_folder='src/templates', static_folder='src/static')
if ENV == 'dev':
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = LOCAL_SQLALCHEMY_DATABASE_URI
else:
app.debug = False
app.config['SQLALCHEMY_DATABASE_URI'] = SERVER_SQLALCHEMY_DATABASE_URI
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = SQLALCHEMY_TRACK_MODIFICATIONS
# Init db
db = SQLAlchemy(app)
# Init ma
ma = Marshmallow(app)
from src.api import metrics_api
app.register_blueprint(metrics_api, url_prefix=METRIC)
# added route for index.html webpage
@app.route('/')
@app.route('/index.html')
def index():
return render_template('index.html')
# added route for api-description webpage
@app.route('/api-description.html')
def apidescription():
return render_template('api-description.html')
# Run Server
if __name__ == '__main__':
app.run()