Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
uv sync --dev
cd 01-hello && uv run pywrangler dev --help
cd hello && uv run pywrangler dev --help

- name: Run tests
run: uv run pytest -vv
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a collection of examples for [writing Cloudflare Workers in Python](http
## Get started

1. `git clone https://github.com/cloudflare/python-workers-examples`
2. `cd 01-hello`
2. `cd hello`
3. `uvx --from workers-py pywrangler dev`
4. Press the `b` key to open a browser tab, and make a request to your Worker

Expand All @@ -15,25 +15,25 @@ Need to deploy your Worker to Cloudflare? Python Workers are in open beta and ha

## Examples

- [**`01-hello/`**](01-hello) — the most basic Python Worker
- [**`02-binding/`**](02-binding) — shows how [bindings](https://developers.cloudflare.com/workers/configuration/bindings/) work in Python Workers. Put a key into Workers KV, and then read it.
- [**`03-fastapi/`**](03-fastapi) — demonstrates how to use the [FastAPI](https://fastapi.tiangolo.com/) package with Python Workers
- [**`04-query-d1/`**](04-query-d1) - shows how to query D1 with Python Workers
- [**`05-langchain/`**](05-langchain) — demonstrates how to use the [LangChain](https://pypi.org/project/langchain/) package with Python Workers. Currently broken.
- [**`06-assets/`**](06-assets) — An example with an assets binding.
- [**`07-durable-objects/`**](07-durable-objects) — An example with storing state in a [Durable Object](https://developers.cloudflare.com/durable-objects/).
- [**`08-cron/`**](08-cron) — shows a simple [cron job](https://developers.cloudflare.com/workers/configuration/cron-triggers/).
- [**`09-workers-ai/`**](09-workers-ai) makes a call [Workers AI](https://developers.cloudflare.com/workers-ai/) to run inference on Cloudflare's Global Network.
- [**`10-workflows/`**](10-workflows) — shows a durable [Workflows](https://developers.cloudflare.com/workflows/) example.
- [**`11-opengraph/`**](11-opengraph) — shows how to use [HTMLRewriter](https://developers.cloudflare.com/workers/runtime-apis/html-rewriter/) to generate OpenGraph images with Python Workers.
- [**`12-image-gen/`**](12-image-gen) — shows how to use [Pillow](https://pillow.readthedocs.io/en/stable/) to generate images with Python Workers.
- [**`13-js-api-pygments/`**](13-js-api-pygments) — shows how to use [Pygments](https://pygments.org/) to highlight code with Python Workers.
- [**`14-websocket-stream-consumer/`**](14-websocket-stream-consumer) — shows how to use [WebSocket](https://developers.cloudflare.com/workers/runtime-apis/websockets/) to consume a stream of data with Python Workers.
- [**`15-chatroom/`**](15-chatroom) - A real-time chatroom using WebSocket.
- [**`16-sync-http-clients/`**](16-sync-http-clients) — demonstrates outbound HTTP with synchronous Python clients (`requests`, `urllib3`, and `httpx.Client`).
- [**`17-dynamic-py-py/`**](17-dynamic-py-py) — shows how to load and run a Python Worker dynamically at runtime using a [Worker Loader](https://developers.cloudflare.com/workers/runtime-apis/bindings/worker-loader/) binding.
- [**`18-django/`**](18-django) — runs a naive Django WSGI application directly on Python Workers.
- [**`19-django-todo-d1/`**](19-django-todo-d1) — uses Django with D1 for a basic TODO application.
- [**`hello/`**](hello) — the most basic Python Worker
- [**`binding/`**](binding) — shows how [bindings](https://developers.cloudflare.com/workers/configuration/bindings/) work in Python Workers. Put a key into Workers KV, and then read it.
- [**`fastapi/`**](fastapi) — demonstrates how to use the [FastAPI](https://fastapi.tiangolo.com/) package with Python Workers
- [**`query-d1/`**](query-d1) - shows how to query D1 with Python Workers
- [**`langchain/`**](langchain) — demonstrates how to use the [LangChain](https://pypi.org/project/langchain/) package with Python Workers. Currently broken.
- [**`assets/`**](assets) — An example with an assets binding.
- [**`durable-objects/`**](durable-objects) — An example with storing state in a [Durable Object](https://developers.cloudflare.com/durable-objects/).
- [**`cron/`**](cron) — shows a simple [cron job](https://developers.cloudflare.com/workers/configuration/cron-triggers/).
- [**`workers-ai/`**](workers-ai) makes a call [Workers AI](https://developers.cloudflare.com/workers-ai/) to run inference on Cloudflare's Global Network.
- [**`workflows/`**](workflows) — shows a durable [Workflows](https://developers.cloudflare.com/workflows/) example.
- [**`opengraph/`**](opengraph) — shows how to use [HTMLRewriter](https://developers.cloudflare.com/workers/runtime-apis/html-rewriter/) to generate OpenGraph images with Python Workers.
- [**`image-gen/`**](image-gen) — shows how to use [Pillow](https://pillow.readthedocs.io/en/stable/) to generate images with Python Workers.
- [**`js-api-pygments/`**](js-api-pygments) — shows how to use [Pygments](https://pygments.org/) to highlight code with Python Workers.
- [**`websocket-stream-consumer/`**](websocket-stream-consumer) — shows how to use [WebSocket](https://developers.cloudflare.com/workers/runtime-apis/websockets/) to consume a stream of data with Python Workers.
- [**`chatroom/`**](chatroom) - A real-time chatroom using WebSocket.
- [**`sync-http-clients/`**](sync-http-clients) — demonstrates outbound HTTP with synchronous Python clients (`requests`, `urllib3`, and `httpx.Client`).
- [**`dynamic-py-py/`**](dynamic-py-py) — shows how to load and run a Python Worker dynamically at runtime using a [Worker Loader](https://developers.cloudflare.com/workers/runtime-apis/bindings/worker-loader/) binding.
- [**`django/`**](django) — runs a naive Django WSGI application directly on Python Workers.
- [**`django-todo-d1/`**](django-todo-d1) — uses Django with D1 for a basic TODO application.



Expand Down
2 changes: 1 addition & 1 deletion 06-assets/README.md → assets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Assets Handling Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/06-assets)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/assets)

Warning: Python support in Workers is experimental and things will break. This
example is meant for reference only right now; you should be prepared to update
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 02-binding/README.md → binding/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Environment Binding Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/02-binding)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/binding)

Warning: Python support in Workers is experimental and things will break. This
example is meant for reference only right now; you should be prepared to update
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 15-chatroom/README.md → chatroom/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WebSocket chatroom

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/15-chatroom)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/chatroom)

## How to Run

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 08-cron/README.md → cron/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cron Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/08-cron)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/cron)

## How to Run

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 19-django-todo-d1/README.md → django-todo-d1/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Django TODO + D1 Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/19-django-todo-d1)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/django-todo-d1)

This example uses Django with [django-cf](https://pypi.org/project/django-cf/) and a D1 database to serve a small TODO API under `/api/*`, plus a static frontend from `public/` served by [Workers Static Assets](https://developers.cloudflare.com/workers/static-assets/).

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 18-django/README.md → django/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Django WSGI Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/18-django)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/django)

This example runs a small, conventional Django project directly on Cloudflare Workers using Django's WSGI application.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 07-durable-objects/README.md → durable-objects/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Durable Objects Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/07-durable-objects)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/durable-objects)

## How to Run

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions 17-dynamic-py-py/README.md → dynamic-py-py/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 17-dynamic-py-py — Python Worker loads a Python Dynamic Worker
# dynamic-py-py — Python Worker loads a Python Dynamic Worker

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/17-dynamic-py-py)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/dynamic-py-py)

This example shows how a Python Worker can use the [Worker Loader](https://developers.cloudflare.com/dynamic-workers/) binding to dynamically load and execute another Python Worker at runtime.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 03-fastapi/README.md → fastapi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FastAPI + Jinja2 Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/03-fastapi)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/fastapi)

## How to Run

Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion 03-fastapi/src/worker.py → fastapi/src/worker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import jinja2
from fastapi import FastAPI, Request
from workers import WorkerEntrypoint

from fastapi import FastAPI, Request

environment = jinja2.Environment()
template = environment.from_string("Hello, {{ name }}!")

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion 01-hello/README.md → hello/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hello World Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/01-hello)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/hello)

Warning: Python support in Workers is experimental and things will break. This
example is meant for reference only right now; you should be prepared to update
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 12-image-gen/README.md → image-gen/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Image Generation with Pillow Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/12-image-gen)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/image-gen)

This example demonstrates how to build a Python Worker that dynamically generates images using the Pillow (PIL) library.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions 13-js-api-pygments/README.md → js-api-pygments/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 13-js-api-pygments – Python RPC Server & TS Client
# js-api-pygments – Python RPC Server & TS Client

This example shows how to use **JS RPC** to connect a **Python Worker** (server) to a **TypeScript Worker** (client).

Expand All @@ -23,7 +23,7 @@ The Python Worker exposes a Pygments-powered `highlight_code` RPC method. The TS
### 1. Install and run the Python RPC server

```bash
cd 13-js-api-pygments/py
cd js-api-pygments/py
uv run pywrangler dev
```

Expand All @@ -34,7 +34,7 @@ This starts the Python Worker defined in `py/wrangler.jsonc`.
Open a **second terminal**:

```bash
cd 13-js-api-pygments/ts
cd js-api-pygments/ts
npm run dev
```

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 05-langchain/README.md → langchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Because this example uses a remote Workers AI binding, local development require

## Notes

- If you want the lower-level direct binding example, see [`09-workers-ai/`](../09-workers-ai).
- If you want the lower-level direct binding example, see [`workers-ai/`](../workers-ai).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 11-opengraph/README.md → opengraph/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenGraph Meta Tag Injection Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/11-opengraph)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/opengraph)

This example demonstrates how to build a Python Worker that dynamically injects OpenGraph meta tags into web pages based on the request path. This is perfect for controlling how your content appears when shared on social media platforms like Facebook, Twitter, LinkedIn, and Slack.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion 04-query-d1/README.md → query-d1/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# D1 Database Query Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/04-query-d1)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/query-d1)

Warning: Python support in Workers is experimental and things will break. This
example is meant for reference only right now; you should be prepared to update
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sync HTTP Clients Example

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/16-sync-http-clients)
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/python-workers-examples/tree/main/sync-http-clients)

This example demonstrates outbound HTTP from a Python Worker using synchronous Python HTTP clients known to work in the current runtime:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def pywrangler_dev_server(directory: str):
# Wait for server to be ready
ready = False
timeout = 30
if "CI" in os.environ and directory.startswith("01"):
if "CI" in os.environ and directory == "hello":
# Starting the server the first time takes a really long time in CI.
# TODO: Why does this happen?
timeout = 300
Expand Down Expand Up @@ -76,7 +76,7 @@ def dev_server(request):
return

test_name = request.node.name
# Extract directory name from test name (e.g., "test_01_hello" -> "01-hello")
# Extract directory name from test name (e.g., "test_hello" -> "hello")
dir_name = test_name.replace("test_", "").replace("_", "-")

with pywrangler_dev_server(dir_name) as port:
Expand Down
32 changes: 16 additions & 16 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
from conftest import REPO_ROOT


def test_01_hello(dev_server):
def test_hello(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
assert response.text == "Hello world!"
assert response.headers["content-type"] == "text/plain;charset=UTF-8"


def test_02_binding(dev_server):
def test_binding(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
assert response.text == "baz"
assert response.headers["content-type"] == "text/plain;charset=UTF-8"


def test_03_fastapi(dev_server):
def test_fastapi(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
Expand Down Expand Up @@ -57,13 +57,13 @@ def init_db():
"--file",
"db_init.sql",
],
cwd=REPO_ROOT / "04-query-d1",
cwd=REPO_ROOT / "query-d1",
check=True,
)


@pytest.mark.xfail(reason="500 error, fixme")
def test_04_query_d1(init_db, dev_server):
def test_query_d1(init_db, dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
Expand All @@ -75,11 +75,11 @@ def test_04_query_d1(init_db, dev_server):


@pytest.mark.xfail(reason="Requires remote bindings")
def test_05_langchain(dev_server):
def test_langchain(dev_server):
pass


def test_06_assets(dev_server):
def test_assets(dev_server):
port = dev_server
pairs = [
("", "text/html; charset=utf-8"),
Expand All @@ -96,7 +96,7 @@ def test_06_assets(dev_server):
assert response.headers["content-type"] == content_type


def test_07_durable_objects(dev_server):
def test_durable_objects(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}/room-1/show")
assert response.status_code == 200
Expand All @@ -112,7 +112,7 @@ def test_07_durable_objects(dev_server):
assert response.text == "No messages"


def test_16_sync_http_clients(dev_server):
def test_sync_http_clients(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}/sync")
assert response.status_code == 200
Expand All @@ -130,7 +130,7 @@ def test_16_sync_http_clients(dev_server):
assert result["saw_expected_text"] is True


def test_08_cron(dev_server):
def test_cron(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
Expand All @@ -139,7 +139,7 @@ def test_08_cron(dev_server):


@pytest.mark.xfail(reason="AI binding may not work in local dev")
def test_09_workers_ai(dev_server):
def test_workers_ai(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
Expand All @@ -149,7 +149,7 @@ def test_09_workers_ai(dev_server):


@pytest.mark.xfail(reason="500 error, fixme")
def test_10_workflows(dev_server):
def test_workflows(dev_server):
port = dev_server
# Test default endpoint
response = requests.get(f"http://localhost:{port}")
Expand All @@ -173,7 +173,7 @@ def test_10_workflows(dev_server):
assert isinstance(status, dict)


def test_18_django(dev_server):
def test_django(dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}")
assert response.status_code == 200
Expand All @@ -182,7 +182,7 @@ def test_18_django(dev_server):


@pytest.fixture
def init_19_django_todo_d1_db():
def init_django_todo_d1_db():
subprocess.run(
[
"uv",
Expand All @@ -194,12 +194,12 @@ def init_19_django_todo_d1_db():
"django-todo-d1",
"--local",
],
cwd=REPO_ROOT / "19-django-todo-d1",
cwd=REPO_ROOT / "django-todo-d1",
check=True,
)


def test_19_django_todo_d1(init_19_django_todo_d1_db, dev_server):
def test_django_todo_d1(init_django_todo_d1_db, dev_server):
port = dev_server
response = requests.get(f"http://localhost:{port}/api/health/")
assert response.status_code == 200
Expand Down
Loading
Loading