Return a task that when awaited runs this application. This is best used for development only, see Hypercorn for production servers. Arguments: host: Hostname to listen on. By default this is loopback only, use 0.0.0.0 to have the server listen e
(
self,
host: str = "127.0.0.1",
port: int = 5000,
debug: bool | None = None,
ca_certs: str | None = None,
certfile: str | None = None,
keyfile: str | None = None,
shutdown_trigger: Callable[..., Awaitable[None]] | None = None,
)
| 890 | restart() |
| 891 | |
| 892 | def run_task( |
| 893 | self, |
| 894 | host: str = "127.0.0.1", |
| 895 | port: int = 5000, |
| 896 | debug: bool | None = None, |
| 897 | ca_certs: str | None = None, |
| 898 | certfile: str | None = None, |
| 899 | keyfile: str | None = None, |
| 900 | shutdown_trigger: Callable[..., Awaitable[None]] | None = None, |
| 901 | ) -> Coroutine[None, None, None]: |
| 902 | """Return a task that when awaited runs this application. |
| 903 | |
| 904 | This is best used for development only, see Hypercorn for |
| 905 | production servers. |
| 906 | |
| 907 | Arguments: |
| 908 | host: Hostname to listen on. By default this is loopback |
| 909 | only, use 0.0.0.0 to have the server listen externally. |
| 910 | port: Port number to listen on. |
| 911 | debug: If set enable (or disable) debug mode and debug output. |
| 912 | ca_certs: Path to the SSL CA certificate file. |
| 913 | certfile: Path to the SSL certificate file. |
| 914 | keyfile: Path to the SSL key file. |
| 915 | |
| 916 | """ |
| 917 | config = HyperConfig() |
| 918 | config.access_log_format = "%(h)s %(r)s %(s)s %(b)s %(D)s" |
| 919 | config.accesslog = "-" |
| 920 | config.bind = [f"{host}:{port}"] |
| 921 | config.ca_certs = ca_certs |
| 922 | config.certfile = certfile |
| 923 | if debug is not None: |
| 924 | self.debug = debug |
| 925 | config.errorlog = config.accesslog |
| 926 | config.keyfile = keyfile |
| 927 | |
| 928 | return serve(self, config, shutdown_trigger=shutdown_trigger) |
| 929 | |
| 930 | def test_client( |
| 931 | self, use_cookies: bool = True, **kwargs: Any |