page:guides:starlette:configuration secrets

Configure environment and secrets for Starlette

Summary

Configuration and secrets for a Starlette app on Ample. Verified on Starlette: an --env value delivered encrypted and reported as present without being echoed (secret=set). Build and start: pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template.

Resource Requirements

Infrastructure Requirements

Workload

Configure environment and secrets

Prerequisites

  1. A Starlette project (pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template)
  2. An Ample account token with servers:write

Tested Configuration

Workflow Steps

  1. Build and start
    pip install into .ample/python from requirements.txt, then uvicorn from run.py reading PORT on the python-3.12 template; the server must bind 0.0.0.0 on PORT.

  2. Pass values on deploy
    Use --env KEY=value (repeatable) or --env-file; values are encrypted at rest and reused on redeploys. Declare names only in ample.toml.
    Command: ample deploy . --name --public --start "python3 run.py" --env MY_SECRET=...

  3. Verify
    Fetch the live URL and /p/configuration-secrets on the example; on failure read the build and runtime logs.
    Command: ample logs --kind build

Examples

Success Checks

  1. App responds on its public URL

    • Kind: http_get
    • Path: /
    • Expect: ample canary starlette patterns
  2. Configuration-secrets check from the example

    • Kind: http_get
    • Path: /p/configuration-secrets
    • Expect: see the pattern fixture checks

Limitations

Cost Estimate

Evidence Summary

Last Verified At

2026-09-21T01:21:36Z

Unknowns