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/runtime-and-entrypoints.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/runtime-and-entrypoints.md')
| -rw-r--r-- | skills/vercel-python/references/runtime-and-entrypoints.md | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/skills/vercel-python/references/runtime-and-entrypoints.md b/skills/vercel-python/references/runtime-and-entrypoints.md index 018a3ce..46b562d 100644 --- a/skills/vercel-python/references/runtime-and-entrypoints.md +++ b/skills/vercel-python/references/runtime-and-entrypoints.md @@ -4,33 +4,21 @@ Use this reference when Vercel cannot find a Python app, the callable is wrong, ## Entrypoint Discovery -Vercel's Python builder looks for conventional entrypoint files named: +Entrypoint resolution follows this priority: -- `app.py` -- `index.py` -- `server.py` -- `main.py` -- `wsgi.py` -- `asgi.py` +1. **`[tool.vercel].entrypoint`** in `pyproject.toml` — explicit path, highest priority. +2. **Framework-specific discovery:** + - **Django:** The builder reads `manage.py` to find `DJANGO_SETTINGS_MODULE`, then looks in the settings module for top-level symbols. + - **Everything else:** Conventional files named `app.py`, `index.py`, `server.py`, `main.py`, `wsgi.py`, or `asgi.py`. Search locations are the project root and shallow app directories such as `src`, `app`, and `api`. +3. **`[project.scripts].app`** in `pyproject.toml` — legacy fallback. -The common search locations are the project root and shallow app directories such as `src`, `app`, and `api`. Prefer conventional names when possible. - -For nonstandard layouts, use `pyproject.toml`: +Prefer `[tool.vercel].entrypoint` for new work: ```toml [tool.vercel] entrypoint = "api/main.py" ``` -Legacy projects may use: - -```toml -[project.scripts] -app = "api/main.py" -``` - -Prefer `[tool.vercel].entrypoint` for new work. - ## Callable Symbols For generic Python, FastAPI, and Flask apps, the entrypoint should expose one top-level callable: @@ -68,12 +56,14 @@ The runtime runs ASGI apps through a vendored Uvicorn layer for lifespan support ## Django Discovery -Django detection starts from `manage.py`, usually at the project root or one directory below. The builder looks at Django settings and prefers `ASGI_APPLICATION` over `WSGI_APPLICATION`. +Django detection starts from `manage.py`, usually at the project root or one directory below. The builder reads `manage.py` to find the module used to set `DJANGO_SETTINGS_MODULE`, then looks in that module for top-level symbols. It prefers `ASGI_APPLICATION` over `WSGI_APPLICATION`. + +If the settings module depends on environment variables or other configuration, these must be set in the Vercel project so the build environment can resolve them. Common blockers: - `manage.py` is nested too deeply. -- `DJANGO_SETTINGS_MODULE` cannot import because dependencies or environment variables are missing. +- `DJANGO_SETTINGS_MODULE` cannot import because dependencies or environment variables are missing. Set required env vars in the Vercel project settings. - Settings only define `WSGI_APPLICATION` when the app expects ASGI behavior. ## Working Directory |
