Quick Start

Get pyserve running in under 5 minutes.

1. Create Configuration File

Create a file named config.yaml in your project directory:

http:
  static_dir: ./static
  templates_dir: ./templates

server:
  host: 0.0.0.0
  port: 8080

logging:
  level: INFO
  console_output: true

extensions:
  - type: routing
    config:
      regex_locations:
        "__default__":
          root: "./static"
          index_file: "index.html"

2. Create Static Directory

Create a static folder and add an index.html:

mkdir -p static
echo '<h1>Hello from pyserve!</h1>' > static/index.html

3. Start the Server

pyserve

You should see output like:

Starting PyServe server on 0.0.0.0:8080

4. Open in Browser

Navigate to http://localhost:8080 — you should see your page!

Using CLI Options

Override configuration via command line:

# Use a different config file
pyserve -c /path/to/config.yaml

# Override host and port
pyserve --host 127.0.0.1 --port 9000

# Enable debug mode (verbose logging)
pyserve --debug

Example: Serve Documentation

Serve a documentation directory with proper caching:

http:
  static_dir: ./docs

server:
  host: 0.0.0.0
  port: 8000

extensions:
  - type: routing
    config:
      regex_locations:
        "=/":
          root: "./docs"
          index_file: "index.html"
        
        "~*\\.(css|js)$":
          root: "./docs"
          cache_control: "public, max-age=3600"
        
        "~*\\.html$":
          root: "./docs"
          cache_control: "no-cache"
        
        "__default__":
          root: "./docs"
          index_file: "index.html"
Next Steps: