mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-11 08:08:32 -06:00
36 lines
895 B
Python
36 lines
895 B
Python
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_login import LoginManager
|
|
|
|
# init SQLAlchemy
|
|
db = SQLAlchemy()
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
|
|
app.config['SECRET_KEY'] = 'secret key goes here'
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite'
|
|
|
|
db.init_app(app)
|
|
|
|
login_manager = LoginManager()
|
|
login_manager.login_view = 'auth.login'
|
|
login_manager.init_app(app)
|
|
|
|
from .models import User
|
|
|
|
@login_manager.user_loader
|
|
def load_user(user_id):
|
|
return User.query.get(int(user_id))
|
|
|
|
# idk if i need the rest of this shit below
|
|
|
|
# blueprint for auth routes in app
|
|
from .auth import auth as auth_blueprint
|
|
app.register_blueprint(auth_blueprint)
|
|
|
|
# blueprint for non-auth parts of app
|
|
from .main import main as main_blueprint
|
|
app.register_blueprint(main_blueprint)
|
|
|
|
return app |