Default starter for Python

A basic starter kit that demonstrates routing and simple responses in Python.

Platform:
Fastly Compute
Language:
Python
Repo:
https://github.com/fastly/compute-starter-kits/tree/main/starter-kits/python/default

Use this starter

Using the Fastly CLI, create a new project using this starter somewhere on your computer:

$ fastly compute init --from=starter-kits/python/default

Features

  • Shows use of [WSGI][wsgi] to handle requests
  • Shows dependency management with [uv][uv] via pyproject.toml
  • Uses [Flask][flask] from [PyPI][pypi] for basic request routing and handling
  • Build synthetic responses at the edge

Understanding the code

This starter kit is intentionally fairly minimal; while Flask is included as a dependency alongside the [Fastly Compute SDK for Python][compute-sdk-python], this is meant primarily as a demonstration of use of a lightweight framework that implements the [WSGI][wsgi] interface. [Bottle][bottle] is another popular microframework which may be used. Python services may also be written without any additional framework dependencies.

The starter doesn't require the use of any backends. Once deployed, you will have a Fastly service running on Compute that can generate synthetic responses at the edge.

Next steps

Starters are a good way to bootstrap a project. For more specific use cases, and answers to common problems, try our library of code examples.