from flask import Flask
from secrets import token_hex

def create_app():
    app = Flask(__name__)
    app.secret_key = token_hex()

    from app.db import init_db
    init_db()

    from app.routes import bp
    app.register_blueprint(bp)

    return app
