Run alembic migration in gunicorn on_start hoook
This commit is contained in:
parent
a88f16b1ac
commit
c88d52da3d
3 changed files with 18 additions and 7 deletions
|
|
@ -1,2 +1,2 @@
|
|||
UPGRADE_PIP_TO_LATEST=1
|
||||
APP_CONFIG=/opt/app-root/src/gunicorn.cfg
|
||||
APP_CONFIG=/opt/app-root/src/gunicorn.cfg.py
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
import logging
|
||||
import sys
|
||||
|
||||
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||
gunicorn_logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
bind = "0.0.0.0:8080"
|
||||
17
gunicorn.cfg.py
Normal file
17
gunicorn.cfg.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import logging
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def on_starting(server):
|
||||
"""Executes code before the master process is initialized"""
|
||||
print("GUNICORN ON STARTING HOOOK")
|
||||
os.system("python run_cli.py upgrade_db")
|
||||
|
||||
|
||||
|
||||
print("LOADING gunnicorn.cfg.py")
|
||||
gunicorn_logger = logging.getLogger("gunicorn.error")
|
||||
gunicorn_logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||
bind = "0.0.0.0:8080"
|
||||
Loading…
Add table
Add a link
Reference in a new issue