runner - Run applications on a local development server

Run an aiohttp.web.Application on a local development server. If debug is set to True on the application, the server will automatically reload when code changes.

from aiohttp import web
from aiohttp_utils import run

app = web.Application()
# ...
run(app, app_uri='path.to.module:app', reload=True, port=5000)

Warning

Auto-reloading functionality is currently experimental.

aiohttp_utils.runner.run(app: aiohttp.web_app.Application, **kwargs)[source]

Run an aiohttp.web.Application using gunicorn.

Parameters:
  • app (Application) – The app to run.
  • app_uri (str) – Import path to app. Takes the form $(MODULE_NAME):$(VARIABLE_NAME). The module name can be a full dotted path. The variable name refers to the aiohttp.web.Application instance. This argument is required if reload=True.
  • host (str) – Hostname to listen on.
  • port (int) – Port of the server.
  • reload (bool) – Whether to reload the server on a code change. If not set, will take the same value as app.debug. EXPERIMENTAL.
  • kwargs – Extra configuration options to set on the GunicornApp's config object.
class aiohttp_utils.runner.GunicornApp(app: aiohttp.web_app.Application, app_uri: str = None, *args, **kwargs)[source]
load_config()[source]

This method is used to load the configuration from one or several input(s). Custom Command line, configuration file. You have to override this method in your class.