blob: eb2f6e1b238267ca3ddca2d61988db8448289840 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# 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.")
if __name__ == "__main__":
when_ready()
|