page:guides:flask:build and start
Configure build and start for Flask
Summary
Configure build and start for a Flask app on Ample. Serve the WSGI app with a production server such as waitress from app.py reading PORT; pass --start "python3 app.py". Ample detects the runtime, installs dependencies, runs the build when present and starts the app on the python-3.12 template behind a public HTTPS URL.
Prerequisites
- A requirements.txt (or pyproject) and a start command that reads PORT and binds 0.0.0.0
- An Ample account token with servers:write
Tested Configuration
- Template: python-3.12
- Runtime: python
- Size: s-1vcpu-1gb
- Install:
python3 -m pip install --target .ample/python -r requirements.txt - Start:
PYTHONPATH=.ample/python:${PYTHONPATH:-} python3 app.py
Workflow Steps
- Make the start command bind correctly
Serve the WSGI app with a production server such as waitress from app.py reading PORT; pass --start "python3 app.py". - Deploy
Run the existing synchronous deploy once from the project directory and read the result. Exit 0 is live, 1 is failed, 2 is blocked on a required preflight action. Re-running with no change is a content-addressed no-op. Command:ample deploy . --name --public --format json --start "python3 run.py" - Verify
Fetch the live URL and run the success checks below. On failure read the build log, then the runtime log, fix the cause and deploy again; do not blind-retry. Command:ample logs --kind build
Success Checks
- Description: page or root route responds
Kind: http_get
Path: /
Expect: ample canary flask basic
Limitations
- Verified on the node-22 template at s-1vcpu-1gb; other templates and sizes are not verified by this recipe.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- Apps auto-pause when idle and wake on the next request; always-on is an operator setting, not a plan feature.
- The Flask development server was not used; waitress was tested.