aboutsummaryrefslogtreecommitdiffstats
path: root/gunicorn_config.py
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-04-09 10:34:00 +0100
committerGravatar Gareth Coles <[email protected]>2018-04-09 10:34:00 +0100
commitafc30354493ef346138281c4115118b8b0dde01b (patch)
tree9e3ee401d89a461c2372d6f16aebf6baa6367feb /gunicorn_config.py
parentContribs too picky, need new payment logos (diff)
parentAdded Python 3 cheat sheet to resources.json (diff)
Merge remote-tracking branch 'origin/master'
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.")