Docs: rewrite README with clear Docker and Docker Compose instructions; refactor app into package (auth, admin, pages, db); keep single entrypoint app.py
This commit is contained in:
34
app/__init__.py
Normal file
34
app/__init__.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
from flask import Flask
|
||||
|
||||
from . import db
|
||||
from .auth import auth_bp
|
||||
from .admin import admin_bp
|
||||
from .pages import pages_bp
|
||||
|
||||
|
||||
def create_app() -> Flask:
|
||||
app = Flask(__name__)
|
||||
|
||||
# Basic config
|
||||
app.config["SECRET_KEY"] = os.environ.get(
|
||||
"SECRET_KEY",
|
||||
"dev-secret-change-me",
|
||||
)
|
||||
app.config["DATABASE"] = os.environ.get(
|
||||
"DATABASE",
|
||||
os.path.join(os.path.dirname(os.path.dirname(__file__)), "app.db"),
|
||||
)
|
||||
app.config["ADMIN_USERNAME"] = os.environ.get("ADMIN_USERNAME", "ruslan")
|
||||
app.config["ADMIN_PASSWORD"] = os.environ.get("ADMIN_PASSWORD", "utOgbZ09ruslan")
|
||||
|
||||
# Init DB hooks
|
||||
db.init_app(app)
|
||||
|
||||
# Register blueprints
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(admin_bp)
|
||||
app.register_blueprint(pages_bp)
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user