-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapp.py
43 lines (32 loc) · 1.1 KB
/
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
40
41
42
43
from flask import Flask, render_template, redirect, url_for, request, g
from flask_cors import CORS
import connexion
from swagger_ui_bundle import swagger_ui_3_path
from nith_result.nith_result import result
from docs.main import docs
from cache import cache
from gzipped import gzipped
connexionApp = connexion.App(__name__,options={'swagger_path': swagger_ui_3_path,'swagger_url': 'doc'})
app = connexionApp.app
app.config['SECRET_KEY'] = 'you-will-never-guess'
# app.config['EXPLAIN_TEMPLATE_LOADING'] = True
CORS(app)
cache.init_app(app)
# combining various blueprints
app.register_blueprint(result,url_prefix='/result/')
app.register_blueprint(docs,url_prefix='/docs/')
# register swagger apis here
connexionApp.add_api('nith_result_api/swagger.yml')
app.finalize_request = gzipped(app.finalize_request)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/about/')
def about():
return "Hi! I'm SimpleX."
app2 = app
app = connexionApp
if __name__ == '__main__':
# print(app.url_map) # To print all paths
# print(connexionApp.app.url_map)
app.run(debug=True)