aboutsummaryrefslogtreecommitdiffstats
path: root/gunicorn_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'gunicorn_config.py')
-rw-r--r--gunicorn_config.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gunicorn_config.py b/gunicorn_config.py
new file mode 100644
index 00000000..7e17b0cc
--- /dev/null
+++ b/gunicorn_config.py
@@ -0,0 +1,12 @@
+# coding=utf-8
+def when_ready(_server):
+ """ server hook that only runs when the gunicorn master process loads """
+
+ print("Creating tables...")
+
+ from pysite.database import RethinkDB
+
+ db = RethinkDB(loop_type=None)
+ created = db.create_tables()
+
+ print(f"Created {created} tables.")