-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
36 lines (32 loc) · 1.01 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
#!/usr/bin/env python3
"""Main app entry point
"""
from flask import Flask
from flask_cors import CORS
from flask_login import LoginManager
from app.models import storage
from app.main.main import main
from app.auth.auth import auth
from app.api.v1.views.files import api_v1_users
from app.api.v1.views.container import api_v1_container
from app.auth.db import authDB
from app.models import mongodb_store
app = Flask(__name__)
app.config['SECRET_KEY'] = 'thisisasecret'
login_manager = LoginManager()
login_manager.init_app(app)
cors = CORS(app)
app.register_blueprint(main)
app.register_blueprint(auth, url_prefix='/auth')
app.register_blueprint(api_v1_users, url_prefix='/api/v1/users')
app.register_blueprint(api_v1_container, url_prefix='/api/v1/container')
@login_manager.user_loader
def user_loader(user_id):
"""Given 'user_id', returns associated
User object
"""
authenticateDB = authDB()
user = authenticateDB.retrieve_user(user_id)
return user
if __name__ == "__main__":
app.run(debug=True)