You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -352,3 +352,40 @@ prod:
352
352
export P_PROFILE=prod
353
353
python app.py
354
354
```
355
+
356
+
## Example: containerized / twelve-factor app
357
+
358
+
No config file needed. Parameters come entirely from environment variables — the [twelve-factor](https://12factor.net/config) way. A `.env` file is picked up automatically in local development; in production, env vars are injected by the container runtime.
359
+
360
+
**`app.py`**
361
+
```python
362
+
import paramflow as pf
363
+
364
+
params = pf.load() # no file — reads from .env locally, env vars in production
365
+
366
+
# read params
367
+
params.db_url
368
+
params.debug
369
+
params.port
370
+
```
371
+
372
+
**`.env`** (local development, not committed to version control)
373
+
```
374
+
P_DB_URL=postgres://localhost/mydb
375
+
P_DEBUG=true
376
+
P_PORT=8080
377
+
```
378
+
379
+
Run locally — `.env` is discovered automatically:
380
+
```sh
381
+
python app.py
382
+
```
383
+
384
+
Run in production — env vars injected by the container:
0 commit comments