moving styling and views to be more consistent and for gallery view to be less cumbersome.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# app/__init__.py
|
||||
|
||||
import click
|
||||
from flask import Flask
|
||||
from flask.cli import with_appcontext
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_migrate import Migrate
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
@@ -11,6 +13,18 @@ import sqlite3
|
||||
db = SQLAlchemy()
|
||||
migrate = Migrate()
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# CLI Commands
|
||||
# =============================================================================
|
||||
|
||||
@click.command("version-check")
|
||||
@with_appcontext
|
||||
def version_check_command():
|
||||
"""Check app version and run data migrations if needed (e.g., phash recomputation)."""
|
||||
from app.utils.version_migration import check_and_run_migrations
|
||||
check_and_run_migrations()
|
||||
|
||||
@event.listens_for(Engine, "connect")
|
||||
def set_sqlite_pragma(dbapi_connection, connection_record):
|
||||
# Only apply to SQLite connections
|
||||
@@ -38,4 +52,7 @@ def create_app(config_class='config.Config'):
|
||||
def datetimeformat(value, format="%Y-%m-%d"):
|
||||
return value.strftime(format) if value else ""
|
||||
|
||||
# Register CLI commands
|
||||
app.cli.add_command(version_check_command)
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user