-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
30 lines (21 loc) · 943 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
28
29
30
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from router import recognize, location
from flask_cors import CORS
import os
from pymongo import MongoClient
def get_database():
# Provide the mongodb atlas url to connect python to mongodb using pymongo
CONNECTION_STRING = "mongodb+srv://surveillance_bot:[email protected]/retryWrites=true&w=majority"
client = MongoClient(CONNECTION_STRING)
return client['test']
basedir = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__)
# app.config['SQLALCHEMY_DATABASE_URI'] ='sqlite:///' + os.path.join(basedir, 'database.db')
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
CORS(app)
# db = SQLAlchemy(app)
app.add_url_rule('/recognize', 'recognize', recognize.index, methods=["POST"])
app.add_url_rule('/location', 'location', location.index, methods=["POST"])
if __name__ == "__main__":
app.run(debug=True)