jcbowyer commited on
Commit
5ce4a10
·
verified ·
1 Parent(s): a8cf0c8

Deploy: Consolidated gold tables, fixed nginx docs routing

Browse files
Files changed (1) hide show
  1. api/database.py +13 -3
api/database.py CHANGED
@@ -9,10 +9,20 @@ from typing import Generator
9
 
10
  from api.models import Base
11
 
12
- # Database URL from environment or default to SQLite for development
 
 
 
 
13
  DATABASE_URL = os.getenv(
14
- "DATABASE_URL",
15
- "sqlite:///./data/users.db" # Fallback to SQLite if no PostgreSQL configured
 
 
 
 
 
 
16
  )
17
 
18
  # Handle PostgreSQL URL format for SQLAlchemy 2.0+
 
9
 
10
  from api.models import Base
11
 
12
+ # Database URL priority:
13
+ # 1. NEON_DATABASE_URL_DEV (local development with PostgreSQL)
14
+ # 2. NEON_DATABASE_URL (production Neon PostgreSQL)
15
+ # 3. DATABASE_URL (backwards compatibility)
16
+ # 4. SQLite fallback (no setup required)
17
  DATABASE_URL = os.getenv(
18
+ "NEON_DATABASE_URL_DEV",
19
+ os.getenv(
20
+ "NEON_DATABASE_URL",
21
+ os.getenv(
22
+ "DATABASE_URL",
23
+ "sqlite:///./data/users.db"
24
+ )
25
+ )
26
  )
27
 
28
  # Handle PostgreSQL URL format for SQLAlchemy 2.0+