cli#

Litestar CLI.

litestar#

Litestar CLI.

litestar [OPTIONS] COMMAND [ARGS]...

Options

--app <app_path>#

Module path to a Litestar application

--app-dir <app_dir>#

Look for APP in the specified directory, by adding this to the PYTHONPATH. Defaults to the current working directory.

info#

Show information about the detected Litestar app.

litestar info [OPTIONS]

routes#

Display information about the application’s routes.

litestar routes [OPTIONS]

Options

--schema#

Include schema routes

--exclude <exclude>#

routes to exclude via regex

run#

Run a Litestar app; requires uvicorn.

The app can be either passed as a module path in the form of <module name>.<submodule>:<app instance or factory>, set as an environment variable LITESTAR_APP with the same format or automatically discovered from one of these canonical paths: app.py, asgi.py, application.py or app/__init__.py. When auto-discovering application factories, functions with the name create_app are considered, or functions that are annotated as returning a Litestar instance.

litestar run [OPTIONS]

Options

-r, --reload#

Reload server on changes

-R, --reload-dir <reload_dir>#

Directories to watch for file changes

-I, --reload-include <reload_include>#

Glob patterns for files to include when watching for file changes

-E, --reload-exclude <reload_exclude>#

Glob patterns for files to exclude when watching for file changes

-p, --port <port>#

Serve under this port

Default:

8000

-W, --wc, --web-concurrency <wc>#

The number of HTTP workers to launch

Default:

1

-H, --host <host>#

Server under this host

Default:

127.0.0.1

-F, --fd, --file-descriptor <fd>#

Bind to a socket from this file descriptor.

-U, --uds, --unix-domain-socket <uds>#

Bind to a UNIX domain socket.

-d, --debug#

Run app in debug mode

-P, --pdb, --use-pdb#

Drop into PDB on an exception

--ssl-certfile <ssl_certfile>#

Location of the SSL cert file

--ssl-keyfile <ssl_keyfile>#

Location of the SSL key file

--create-self-signed-cert#

If certificate and key are not found at specified locations, create a self-signed certificate and a key

schema#

Manage server-side OpenAPI schemas.

litestar schema [OPTIONS] COMMAND [ARGS]...

openapi#

Generate an OpenAPI Schema.

litestar schema openapi [OPTIONS]

Options

--output <output>#

output file path

Default:

openapi_schema.json

typescript#

Generate TypeScript specs from the OpenAPI schema.

litestar schema typescript [OPTIONS]

Options

--output <output>#

output file path

Default:

api-specs.ts

--namespace <namespace>#

namespace to use for the typescript specs

sessions#

Manage server-side sessions.

litestar sessions [OPTIONS] COMMAND [ARGS]...

clear#

Delete all sessions.

litestar sessions clear [OPTIONS]

delete#

Delete a specific session.

litestar sessions delete [OPTIONS] SESSION_ID

Arguments

SESSION_ID#

Required argument

version#

Show the currently installed Litestar version.

litestar version [OPTIONS]

Options

-s, --short#

Exclude release level and serial information