diff options
| author | gscho <greg.c.schofield@gmail.com> | 2026-05-07 13:02:47 -0400 |
|---|---|---|
| committer | gscho <greg.c.schofield@gmail.com> | 2026-05-07 13:02:47 -0400 |
| commit | 2ee4d3aec33e7995291abfa78e27573320f36804 (patch) | |
| tree | cb32d7c9af6c6d04fd06a480f3d00b17254a476d /skills/vercel-python/references/frameworks.md | |
| parent | 0850658487094f5fb9aeba2fdcd87071f42c5c74 (diff) | |
Address PR comments and edit with skill-creator.gscho/PY-222-vercel-python-skill
Signed-off-by: gscho <greg.c.schofield@gmail.com>
Diffstat (limited to 'skills/vercel-python/references/frameworks.md')
| -rw-r--r-- | skills/vercel-python/references/frameworks.md | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/skills/vercel-python/references/frameworks.md b/skills/vercel-python/references/frameworks.md index 5da3705..a53fb9a 100644 --- a/skills/vercel-python/references/frameworks.md +++ b/skills/vercel-python/references/frameworks.md @@ -4,7 +4,7 @@ Use this reference for FastAPI, Flask, Django, ASGI/WSGI app shape, static files ## Zero Configuration -Correctly structured Python projects deploy with zero configuration. No `vercel.json` is needed when the entrypoint and callable follow Vercel's conventions. Only add `vercel.json` when explicit overrides are required. +Correctly structured Python projects deploy with zero configuration. No `vercel.json` is needed when the entrypoint and callable follow Vercel's conventions. Do not create a `vercel.json` unless the project genuinely needs an override — unnecessary config is a common source of deployment failures. ## FastAPI @@ -23,11 +23,10 @@ def read_root(): FastAPI is ASGI. Declare both `fastapi` and an ASGI server such as `uvicorn` in the dependency manifest. WSGI frameworks like Flask do not need `uvicorn`. -Vercel searches `app/`, `src/`, and `api/` directories in addition to the project root. An entrypoint at `app/main.py` with a top-level `app` callable works without any extra configuration. +See `runtime-and-entrypoints.md` for entrypoint discovery rules and conventional file names. Typical fixes: -- Put the app in `main.py`, `app.py`, `app/main.py`, or configure `[tool.vercel].entrypoint`. - Export `app` at top level. - Do not rely on local dev commands such as `uvicorn main:app` as the deploy entrypoint. @@ -93,10 +92,41 @@ Django static collection can run during build when static settings are compatibl - Default Django static storage. - `ManifestStaticFilesStorage`. - WhiteNoise `CompressedManifestStaticFilesStorage`. -- Some `django-storages` configurations. +- `django-storages` configurations. `WHITENOISE_USE_FINDERS=True` can work without `STATIC_ROOT`, but prefer an explicit static setup for production. +## Background Workers + +Vercel supports background task processing via the `vercel-workers` package. Worker services run alongside the web service and consume messages from Vercel Queues. + +The `vercel-workers` package provides: + +- `send()` and `@subscribe` primitives for publishing and consuming queue messages. +- Adapters for **Celery**, **Dramatiq**, and **Django tasks**. + +Worker services are configured in `vercel.json` using `experimentalServices`: + +```json +{ + "experimentalServices": { + "web": { + "framework": "fastapi", + "entrypoint": "main.py", + "routePrefix": "/" + }, + "worker": { + "type": "worker", + "entrypoint": "worker.py", + "topic": "default", + "consumer": "default" + } + } +} +``` + +When a Python app requires background processing (task queues, scheduled jobs, event-driven workers), check whether `vercel-workers` can handle the workload before concluding that the app is incompatible with Vercel. + ## Databases Vercel Marketplace provides managed database integrations that automatically configure connection environment variables: |
