aboutsummaryrefslogtreecommitdiffstats
path: root/gunicorn_config.py
blob: f863edd44c6824e25f1ccd76217d89de8910c1f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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.")