server.cli
The onegov.server can be run through the ‘onegov-server’ command after installation.
Said command runs the onegov server with the given configuration file in the foreground.
Use this for debugging/development only.
Example:
onegov-server --config-file test.yml
The onegov-server will load ‘onegov.yml’ by default and it will restart when any file in the current folder or any file somewhere inside ‘./src’ changes.
Changes to omlette directories require a manual restart.
A onegov.yml file looks like this:
applications:
- path: /apps/*
application: my.app.TestApp
namespace: apps
configuration:
allowed_hosts_expression: '^[a-z]+.apps.dev'
dsn: postgres://username:password@localhost:5432/db
identity_secure: false
identity_secret: very-secret-key
logging:
formatters:
simpleFormater:
format: '%(asctime)s - %(levelname)s: %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
console:
class: logging.StreamHandler
formatter: simpleFormater
level: DEBUG
stream: ext://sys.stdout
loggers:
onegov.core:
level: DEBUG
handlers: [console]
Attributes
Classes
Measures the time it takes to respond to a request and prints it |
|
Runs the WSGI reference server in a separate process. This is a debug |
|
Wraps the WSGI process, providing the ability to restart the process |
Functions
|
Runs the onegov server with the given configuration file in the |
|
|
|
|
|
Module Contents
- server.cli.run(config_file: str | bytes, port: int, pdb: bool, tracemalloc: bool, mode: Literal['debug', 'production'], sentry_dsn: str | None, sentry_environment: str, sentry_release: str | None, send_ppi: bool, traces_sample_rate: float, profiles_sample_rate: float) None [source]
Runs the onegov server with the given configuration file in the foreground.
Use this for debugging/development only.
Example:
onegov-server --config-file test.yml
The onegov-server will load ‘onegov.yml’ by default and it will restart when any file in the current folder or any file somewhere inside ‘./src’ changes.
Changes to omlette directories require a manual restart.
- server.cli.run_debug(config_file: str | bytes, port: int, pdb: bool, tracemalloc: bool) None [source]
- class server.cli.WSGIRequestMonitorMiddleware(app: _typeshed.wsgi.WSGIApplication)[source]
Measures the time it takes to respond to a request and prints it at the end of the request.
- class server.cli.WsgiProcess(app_factory: Callable[[], WSGIApplication], host: str = '127.0.0.1', port: int = 8080, env: dict[str, str] | None = None, enable_tracemalloc: bool = False)[source]
Bases:
multiprocessing.Process
Runs the WSGI reference server in a separate process. This is a debug process, not used in production.
- class server.cli.WsgiServer(app_factory: Callable[[], WSGIApplication], host: str = '127.0.0.1', port: int = 8080, **kwargs: Any)[source]
Bases:
watchdog.events.FileSystemEventHandler
Wraps the WSGI process, providing the ability to restart the process and acting as an event-handler for watchdog.
- spawn() WsgiProcess [source]