# Deploy Flask on forkrail

> Drop in any Flask WSGI app — no Lambda adapters or custom handlers required. forkrail serves up to 10 concurrent requests per worker via `a2wsgi` and serves `public/` statics from S3.

- Framework: Flask
- Category: APIs & backends
- Status: Production ready
- Adapter / Preset: None (built-in a2wsgi + uvicorn shim)
- Runtime: Python 3.13 arm64 (also 3.12 & 3.14)
- Detection: app.py / index.py / api/index.py defining app
- Memory: 640 MB default
- URL: https://www.forkrail.com/frameworks/flask

## Capabilities

| Capability | Support | Details |
| --- | --- | --- |
| Zero-wrapper WSGI | Supported | Exports standard Flask `app` directly with no Mangum/Zappa |
| 10× concurrent threads | Supported | WSGI runs in 10 threads per warm worker via a2wsgi |
| Static files | Supported | Files in public/ served directly by the router from S3 |
| Vercel compatibility | Supported | Reads vercel.json routes, crons, and requirements.txt |

## 1. Entrypoint & dependencies

Define a top-level `app = Flask(__name__)` in `app.py`, `index.py`, `server.py`, `main.py`, or `wsgi.py` (at the root or in `src/`, `app/`, `api/`), and list dependencies in `requirements.txt`, `pyproject.toml`, or `Pipfile.lock`:

**app.py**

```python
from flask import Flask, jsonify

app = Flask(__name__)

@app.get('/api/status')
def status():
    return jsonify(ok=True, framework='flask')
```

**requirements.txt**

```text
flask==3.1.0
requests==2.32.3
```

## 2. Deploy to forkrail

**Deploy Flask preview and production**

```bash
forkrail deploy
forkrail deploy --prod
```

Every HTTP request, `print()` or `app.logger` line, and outgoing `requests` / `httpx` / `urllib` call appears in ClickHouse logs under the request’s trace ID.

## Related documentation

- [Logs & observability](https://www.forkrail.com/docs/logs-and-observability.md)
- [Firewall](https://www.forkrail.com/docs/firewall.md)
- [Spend budgets](https://www.forkrail.com/docs/spend-budgets.md)
