-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
35 lines (25 loc) · 902 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
31
32
33
34
35
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
# Database configuration code.
app = Flask(__name__)
app.secret_key = b'Nan36Nut37Sha50Van65'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///Nominator.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
login_manager = LoginManager(app=app)
login_manager.login_view = 'auth.login_candidate'
login_manager.login_view = 'auth.login_company'
login_manager.init_app(app)
from models import Candidate, Company
@login_manager.user_loader
def load_user(username):
user = Company.query.filter_by(username=username).first()
if not user:
user = Candidate.query.filter_by(username=username).first()
return user
from auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint)
if __name__ == '__main__':
app.debug = True
app.run()