代码拉取完成,页面将自动刷新
import sys
import time
import psycopg2
import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
logging.info("Checking if table 'django_migrations' exists.")
logging.info("If you want to skip this, just set the environment var")
logging.info("TAIGA_SKIP_DB_CHECK=True on docker-compose.yml on <backend> service.")
CONNECTION_STRING = "dbname='{}' user='{}' host='{}' password='{}'".format(
'wr_prd',
'postgres',
'db',
'postgres'
)
LIMIT_RETRIES = 5
SLEEP_INTERVAL = 5
def postgres_connection(connection_string, retry_counter=1):
try:
connection = psycopg2.connect(connection_string)
except psycopg2.OperationalError as e:
if retry_counter > LIMIT_RETRIES:
logging.error("CAN'T CONNECT TO POSTGRES")
logging.error("Check your connection settings.")
logging.error("Or increase (in docker-compose.yml):")
logging.error(
"TAIGA_DB_CHECK_SLEEP_INTERVAL / TAIGA_DB_CHECK_LIMIT_RETRIES."
)
logging.error("Exception messsage: {}".format(e))
sys.exit(1)
else:
logging.warning("Can't connect to Postgres. Will try again...")
time.sleep(SLEEP_INTERVAL)
retry_counter += 1
return postgres_connection(connection_string, retry_counter)
return connection
cursor = postgres_connection(CONNECTION_STRING).cursor()
cursor.execute(
"select exists(select * from information_schema.tables where table_name=%s)",
('users',)
)
if not cursor.fetchone()[0]:
logging.info("So, it seems like it's the first time you run the <backend>")
logging.info("service for taiga. Will try to:")
logging.info("1) migrate DB; 2) load initial data; 3) compilemessages")
print('missing_flask_users')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。