mirror of
https://github.com/TrentSPalmer/flask_photo_scaling_app.git
synced 2024-12-21 18:22:50 -08:00
socket connection for postgresql
This commit is contained in:
parent
81d3d5fa8e
commit
e20e1529af
4
.env
4
.env
@ -10,7 +10,9 @@ LOGGING_XMPP_COMMAND="/usr/bin/sendxmpp"
|
||||
LOGGING_XMPP_USE_TLS=1
|
||||
|
||||
# then create postrgresql role and database
|
||||
DATABASE_URL="postgresql://<app_user>:<database password for user app_user>@localhost/<app_db>"
|
||||
# DATABASE_URL="postgresql://<app_user>:<database password for user app_user>@localhost/<app_db>"
|
||||
# alternatively for unix socket connection
|
||||
DATABASE_URL="postgresql://<app_user>:<database password for user app_user>@/<app_db>?host=/var/run/postgresql"
|
||||
DATABASE_NAME="<app_db>"
|
||||
DATABASE_USER="<app_user>"
|
||||
DATABASE_PASSWORD="<database password for user app_user>"
|
||||
|
@ -8,6 +8,7 @@ def delete_photo(photo, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor()
|
||||
|
@ -9,6 +9,7 @@ def find_next_previous(photo, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor()
|
||||
@ -58,6 +59,7 @@ def get_photo_list(contributor_id, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
|
||||
|
@ -13,6 +13,7 @@ def process_uploaded_photo(filename, current_user, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor()
|
||||
|
@ -7,6 +7,7 @@ def set_contributor_id_seq(app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
|
||||
|
@ -13,6 +13,7 @@ def get_totp_qr(contributor, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor()
|
||||
@ -32,6 +33,7 @@ def validate_totp(contributor, totp_code, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor()
|
||||
@ -47,6 +49,7 @@ def disable_2fa(contributor, app_config):
|
||||
conn = psycopg2.connect(
|
||||
dbname=app_config['DATABASE_NAME'],
|
||||
user=app_config['DATABASE_USER'],
|
||||
host="/var/run/postgresql",
|
||||
password=app_config['DATABASE_PASSWORD']
|
||||
)
|
||||
cur = conn.cursor()
|
||||
|
Loading…
Reference in New Issue
Block a user