-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
27 lines (22 loc) · 807 Bytes
/
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
from flask import Flask, Blueprint,jsonify
from flask_cors import CORS
import pymongo
import run_model
import constants as CONST
from waitress import serve
import os
from flask_pymongo import PyMongo
app = Flask(__name__)
cors = CORS(app)
app.register_blueprint(run_model.bp, url_prefix='/run_model')
app.config['MONGO_URI']='mongodb+srv://aavishkar_mishra:[email protected]/test?retryWrites=true&w=majority'
mongo=PyMongo(app)
# endpoint to check service status
@app.route("/status")
def check_status():
return jsonify({CONST.STATUS: CONST.SUCCESS, CONST.DATA: None})
if __name__ == "__main__": #Local
app.run(host="localhost", port="3435", debug=True, use_reloader=True)
else: #Production (Heroku)
port = int(os.environ.get('PORT', 33507))
serve(app,port=port)