diff options
Diffstat (limited to 'gunicorn_config.py')
-rw-r--r-- | gunicorn_config.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gunicorn_config.py b/gunicorn_config.py index f863edd4..5b9f9055 100644 --- a/gunicorn_config.py +++ b/gunicorn_config.py @@ -12,6 +12,16 @@ def when_ready(server=None): from pysite.database import RethinkDB db = RethinkDB(loop_type=None) + db.conn = db.get_connection() + + # Create any table that doesn't exist created = db.create_tables() + if created: + tables = ", ".join([f"{table}" for table in created]) + output(f"Created the following tables: {tables}") - output(f"Created {created} tables.") + # Init the tables that require initialization + initialized = db.init_tables() + if initialized: + tables = ", ".join([f"{table} ({count} items)" for table, count in initialized.items()]) + output(f"Initialized the following tables: {tables}") |