basic imports
This commit is contained in:
32
app/main.py
32
app/main.py
@@ -1,38 +1,12 @@
|
||||
import os
|
||||
import psycopg2
|
||||
import time
|
||||
|
||||
|
||||
DB_USER = os.getenv("POSTGRES_USER");
|
||||
DB_PASSWWORD = os.getenv("POSTGRES_PASSWORD");
|
||||
DB_NAME = os.getenv("POSTGRES_DB");
|
||||
DB_HOST = os.getenv("POSTGRES_HOST");
|
||||
|
||||
|
||||
|
||||
def connect_db():
|
||||
while True:
|
||||
try:
|
||||
conn = psycopg2.connect(
|
||||
host=DB_HOST,
|
||||
database=DB_NAME,
|
||||
user=DB_USER,
|
||||
password=DB_PASSWWORD
|
||||
)
|
||||
print("Connected to the database successfully!")
|
||||
return conn
|
||||
except psycopg2.OperationalError as e:
|
||||
print(f"Database connection failed: {e}")
|
||||
time.sleep(3)
|
||||
import pystac_client
|
||||
import geogif
|
||||
import stackstac
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("starting app.")
|
||||
# conn = connect_db();
|
||||
# cursor = conn.cursor()
|
||||
# cursor.execute("SELECT postgis_full_version();")
|
||||
|
||||
# print("obst", cursor.fetchone());
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
psycopg2-binary==2.9.3
|
||||
SQLAlchemy==1.4.36
|
||||
SQLAlchemy==1.4.36
|
||||
pystac_client
|
||||
geogif
|
||||
stackstac
|
||||
|
||||
Reference in New Issue
Block a user