You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
960 B
39 lines
960 B
3 years ago
|
from flask import Flask
|
||
|
from flask_sqlalchemy import SQLAlchemy
|
||
|
from flask_bcrypt import Bcrypt
|
||
|
from flask_migrate import Migrate
|
||
|
from flask_wtf.csrf import CSRFProtect
|
||
|
from flask_login import (
|
||
|
LoginManager,
|
||
|
)
|
||
|
|
||
|
db = SQLAlchemy()
|
||
|
migrate = Migrate()
|
||
|
bcrypt = Bcrypt()
|
||
|
login_manager = LoginManager()
|
||
|
|
||
|
|
||
|
def create_app():
|
||
|
APP = Flask(__name__, static_folder="static")
|
||
|
|
||
|
APP.secret_key = 'secret-key'
|
||
|
APP.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///data/login.db"
|
||
|
APP.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
||
|
|
||
|
login_manager.session_protection = "strong"
|
||
|
login_manager.login_view = "login"
|
||
|
login_manager.login_message_category = "info"
|
||
|
|
||
|
csrf = CSRFProtect()
|
||
|
|
||
|
APP.config['SECRET_KEY'] = 'ty4425hk54a21eee5719b9s9df7sdfklx'
|
||
|
APP.config['UPLOAD_FOLDER'] = 'tmpupload'
|
||
|
|
||
|
csrf.init_app(APP)
|
||
|
login_manager.init_app(APP)
|
||
|
db.init_app(APP)
|
||
|
migrate.init_app(APP, db)
|
||
|
bcrypt.init_app(APP)
|
||
|
|
||
|
return APP
|