betty.serve module - Betty 0.4.0a4 documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.serve module

Provide the Serve API to serve resources within the application.

final class betty.serve.BuiltinProjectServer

  Bases: `ProjectServer`

  A built-in server for a Betty project.

  __init__(project: Project) → None
  property public_url: str

    The server’s public URL.

  async start() → None

    Start the server.

  async stop() → None

    Stop the server.

final class betty.serve.BuiltinServer

  Bases: `Server`

  A built-in server for a WWW directory.

  __init__(www_directory_path: Path, *, root_path: str | None = None, localizer: Localizer) → None
  property public_url: str

    The server’s public URL.

  async start() → None

    Start the server.

  async stop() → None

    Stop the server.

exception betty.serve.NoPublicUrlBecauseServerNotStartedError

  Bases: `ServerNotStartedError`

  A public URL is not yet available because the server has not (fully) started yet.

  __init__()

exception betty.serve.OsError

  Bases: `UserFacingError`, `OSError`

  Raised for I/O errors.

class betty.serve.ProjectServer

  Bases: `Server`

  A web server for a Betty project.

  __init__(project: Project) → None
  async start() → None

    Start the server.

class betty.serve.Server

  Bases: `ABC`

  Provide a development web server.

  __init__(localizer: Localizer)
  async assert_available() → None

    Assert that this server is available.

  abstract property public_url: str

    The server’s public URL.

  async show() → None

    Show the served site to the user.

  async start() → None

    Start the server.

  async stop() → None

    Stop the server.

exception betty.serve.ServerNotStartedError

  Bases: `RuntimeError`

  Raised when a web server has not (fully) started yet.