-
Notifications
You must be signed in to change notification settings - Fork 792
Expand file tree
/
Copy path__init__.py
More file actions
37 lines (27 loc) · 809 Bytes
/
__init__.py
File metadata and controls
37 lines (27 loc) · 809 Bytes
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
#################
#### imports ####
#################
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
import os
################
#### config ####
################
app = Flask(__name__)
bcrypt = Bcrypt(app)
login_manager = LoginManager()
login_manager.init_app(app)
app.config.from_object(os.environ['APP_SETTINGS'])
db = SQLAlchemy(app)
from project.users.views import users_blueprint
from project.home.views import home_blueprint
# register our blueprints
app.register_blueprint(users_blueprint)
app.register_blueprint(home_blueprint)
from models import User
login_manager.login_view = "users.login"
@login_manager.user_loader
def load_user(user_id):
return User.query.filter(User.id == int(user_id)).first()