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