fix: load .env via python-dotenv; SQLite default for local dev
This commit is contained in:
parent
b140c55cda
commit
8d4f9d1fc6
5 changed files with 20 additions and 0 deletions
5
backend/.env.example
Normal file
5
backend/.env.example
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Local dev — SQLite (no server required)
|
||||
DATABASE_URL=sqlite:///./innercontext.db
|
||||
|
||||
# Production — PostgreSQL (set this in your deployment environment)
|
||||
# DATABASE_URL=postgresql+psycopg://user:password@host:5432/innercontext
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
from contextlib import asynccontextmanager
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv() # load .env before db.py reads DATABASE_URL
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ requires-python = ">=3.12"
|
|||
dependencies = [
|
||||
"fastapi>=0.132.0",
|
||||
"psycopg>=3.3.3",
|
||||
"python-dotenv>=1.2.1",
|
||||
"sqlmodel>=0.0.37",
|
||||
"uvicorn[standard]>=0.34.0",
|
||||
]
|
||||
|
|
|
|||
2
backend/uv.lock
generated
2
backend/uv.lock
generated
|
|
@ -241,6 +241,7 @@ source = { virtual = "." }
|
|||
dependencies = [
|
||||
{ name = "fastapi" },
|
||||
{ name = "psycopg" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "sqlmodel" },
|
||||
{ name = "uvicorn", extra = ["standard"] },
|
||||
]
|
||||
|
|
@ -259,6 +260,7 @@ dev = [
|
|||
requires-dist = [
|
||||
{ name = "fastapi", specifier = ">=0.132.0" },
|
||||
{ name = "psycopg", specifier = ">=3.3.3" },
|
||||
{ name = "python-dotenv", specifier = ">=1.2.1" },
|
||||
{ name = "sqlmodel", specifier = ">=0.0.37" },
|
||||
{ name = "uvicorn", extras = ["standard"], specifier = ">=0.34.0" },
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue