diff --git a/.env b/.env index 2f27e69..a01dc2d 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -DATABASE_URL=postgres://postgres:password@192.168.1.204:5432/fuelprices \ No newline at end of file +DATABASE_URL=postgresql://postgres:password@192.168.1.204:5432/fuelprices \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6cf5f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__/ +*.pyc +.env diff --git a/database.py b/database.py index c42961f..15dd316 100644 --- a/database.py +++ b/database.py @@ -5,7 +5,7 @@ from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base # --- Database Configuration --- -DATABASE_URL = "postgresql://postgres:password@192.168.1.204:5432/fuelprices" +DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://postgres:password@192.168.1.204:5432/fuelprices") # Ensure this DATABASE_URL is correct for your setup (e.g., 'db' for Docker Compose, # 'host.docker.internal' or an IP for external DBs) # For your error, it seems you are trying to connect to 192.164.1.204