-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
48 lines (40 loc) · 1.9 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
44
45
46
47
48
from flask import Flask, Blueprint
from api.gyresources.endpoints.PlantController import ns as plant_namespace
from api.gyresources.endpoints.TextController import ns as text_namespace
from api.gyresources.endpoints.TypeController import ns as type_namespace
from api.gyresources.endpoints.ImageController import ns as image_namespace
from api.gyresources.endpoints.UserController import ns as user_namespace
from api.gyresources.endpoints.DiseaseController import ns as disease_namespace
from api.gyresources.endpoints.ClassifierController import ns as classifier_namespace
from api.gyresources.endpoints.LoggerController import ns as logger_namespace
from api.gyresources.endpoints.MessageController import ns as message_namespace
from api.gyresources.endpoints.token import ns as token_namespace
from api.gyresources.endpoints.AnalysisController import ns as analysis_namespace
from api.gyresources.endpoints.AnalysisResultController import ns as analysisResult_namespace
from api.restplus import api
from api.restplus import CELERY as celery
# import settings
app = Flask(__name__)
def initialize_app(flask_app):
flask_app.config.from_object('config.DefaultConfig')
blueprint = Blueprint('api', __name__, url_prefix='/api')
api.init_app(blueprint)
api.add_namespace(plant_namespace)
api.add_namespace(text_namespace)
api.add_namespace(type_namespace)
api.add_namespace(image_namespace)
api.add_namespace(user_namespace)
api.add_namespace(disease_namespace)
api.add_namespace(logger_namespace)
api.add_namespace(token_namespace)
api.add_namespace(analysis_namespace)
api.add_namespace(analysisResult_namespace)
api.add_namespace(message_namespace)
api.add_namespace(classifier_namespace)
flask_app.register_blueprint(blueprint)
return flask_app
def main():
initialize_app(app)
app.run(debug=True, host='0.0.0.0', port=5000)
if __name__ == '__main__':
main()