diff options
Diffstat (limited to 'mediagoblin/app.py')
-rw-r--r-- | mediagoblin/app.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mediagoblin/app.py b/mediagoblin/app.py index ae39694f..7a6a1f33 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -22,6 +22,7 @@ from webob import Request, exc from mediagoblin import routing, util, storage from mediagoblin.db.open import setup_connection_and_db_from_config +from mediagoblin.db.util import MigrationManager from mediagoblin.mg_globals import setup_globals from mediagoblin.init.celery import setup_celery_from_config from mediagoblin.init import get_jinja_loader, get_staticdirector, \ @@ -59,6 +60,16 @@ class MediaGoblinApp(object): self.connection, self.db = setup_connection_and_db_from_config( app_config) + # Init the migration number if necessary + migration_manager = MigrationManager(self.db) + migration_manager.install_migration_version_if_missing() + + # Tiny hack to warn user if our migration is out of date + if not migration_manager.database_at_latest_migration(): + print ( + "*WARNING:* Your migrations are out of date, " + "maybe run ./bin/gmg migrate?") + # Get the template environment self.template_loader = get_jinja_loader( app_config.get('user_template_path')) @@ -93,12 +104,6 @@ class MediaGoblinApp(object): ####################################################### setup_globals( - # TODO: No need to set these two up as globals, we could - # just read them out of mg_globals.app_config - email_sender_address=app_config['email_sender_address'], - email_debug_mode=app_config['email_debug_mode'], - - # Actual, useful to everyone objects app=self, db_connection=self.connection, database=self.db, |