30 lines
869 B
Python
30 lines
869 B
Python
from flask import Flask
|
|
from app.config import Config
|
|
from app.db import init_db, close_db
|
|
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
|
|
# Database lifecycle
|
|
init_db(app)
|
|
app.teardown_appcontext(close_db)
|
|
|
|
# Register blueprints
|
|
from app.routes.auth import bp as auth_bp
|
|
from app.routes.dashboard import bp as dashboard_bp
|
|
from app.routes.checkin import bp as checkin_bp
|
|
from app.routes.profile import bp as profile_bp
|
|
from app.routes.leaderboard import bp as leaderboard_bp
|
|
from app.routes.api import bp as api_bp
|
|
|
|
app.register_blueprint(auth_bp)
|
|
app.register_blueprint(dashboard_bp)
|
|
app.register_blueprint(checkin_bp)
|
|
app.register_blueprint(profile_bp)
|
|
app.register_blueprint(leaderboard_bp)
|
|
app.register_blueprint(api_bp)
|
|
|
|
return app
|