postgres default connection
This commit is contained in:
parent
fb7af852c8
commit
a47007c7dd
1 changed files with 7 additions and 3 deletions
10
backend.py
10
backend.py
|
@ -9,9 +9,13 @@ import json
|
|||
import codecs
|
||||
|
||||
def db_connect():
|
||||
db_host = os.getenv("DB_HOST","localhost")
|
||||
db_password = os.getenv("POSTGRES_PASSWORD","")
|
||||
db = psycopg2.connect(dbname="oedb",host=db_host,password=db_password)
|
||||
try:
|
||||
db = psycopg2.connect(dbname="oedb")
|
||||
except:
|
||||
db_host = os.getenv("DB_HOST","localhost")
|
||||
db_password = os.getenv("POSTGRES_PASSWORD","")
|
||||
db = psycopg2.connect(dbname="oedb",host=db_host,password=db_password)
|
||||
|
||||
return db
|
||||
|
||||
def standard_headers(resp):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue