diff options
Diffstat (limited to 'webmentions_ssg')
| -rw-r--r-- | webmentions_ssg/__init__.py | 6 | ||||
| -rw-r--r-- | webmentions_ssg/cli.py | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/webmentions_ssg/__init__.py b/webmentions_ssg/__init__.py index 8e87485..853045d 100644 --- a/webmentions_ssg/__init__.py +++ b/webmentions_ssg/__init__.py @@ -112,6 +112,12 @@ def create_app(config_class: type[DefaultConfig] | None = None) -> Flask: directory=str(Path(__file__).resolve().parent / "migrations"), command="migrate", ) + + # Flask-Migrate always registers its CLI group. Keep its API available for + # the guarded `flask db` commands, but hide the unrestricted CLI outside DEV. + if not development: + app.cli.commands.pop("migrate", None) + csrf.init_app(app) limiter.init_app(app) mail.init_app(app) diff --git a/webmentions_ssg/cli.py b/webmentions_ssg/cli.py index 3448bbb..b26b35b 100644 --- a/webmentions_ssg/cli.py +++ b/webmentions_ssg/cli.py @@ -196,8 +196,8 @@ def upgrade_db() -> None: raise click.ClickException( "No Flask-Migrate revision table found. " "For a new, empty database run 'flask db create-db'. " - "For a legacy database, inspect its schema and use " - "'flask migrate stamp' only if appropriate." + "For a legacy database, inspect its schema and stamp its revision " + "only if appropriate (the 'flask migrate' CLI is development-only)." ) migrate_upgrade() |
