-
Notifications
You must be signed in to change notification settings - Fork 6
/
manage.py
42 lines (33 loc) · 1.03 KB
/
manage.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
from flask import Flask
from config import session_key, app_config, mongo_config, jwt_secret
from Controllers import PageRoutes, ErrorRoutes
from Utilities.Database import db
from flask_jwt_extended import JWTManager
app = Flask(__name__)
# app settings
app.secret_key = session_key
app.static_folder = app_config['ROOT_PATH'] + '/Views/static'
app.template_folder = app_config['ROOT_PATH'].split('Controllers')[0] + '/Views/templates'
# blueprints init
blueprints = [
PageRoutes.mod,
ErrorRoutes.mod
]
for bp in blueprints:
app.register_blueprint(bp)
# db stuff
app.config['MONGODB_SETTINGS'] = {
'db': mongo_config['DB'],
'username': mongo_config['USERNAME'],
'password': mongo_config['PASSWORD'],
'host': mongo_config['IP'],
'port': mongo_config['PORT'],
'authentication_source': 'admin'
}
db.init_app(app)
# jwt stuff
app.config['JWT_SECRET_KEY'] = jwt_secret
app.config['JWT_TOKEN_LOCATION'] = ['cookies']
jwt = JWTManager(app)
if __name__ == '__main__':
app.run(host="localhost", port=5010, debug=True)