From e3b70d8a510f1c24535481e784ee826cf3921143 Mon Sep 17 00:00:00 2001 From: retoor Date: Fri, 6 Dec 2024 21:01:57 +0100 Subject: [PATCH] Optional hostname and port --- src/app/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/app.py b/src/app/app.py index 6d5d494..b25c83b 100644 --- a/src/app/app.py +++ b/src/app/app.py @@ -38,8 +38,12 @@ class BaseApplication(web.Application): middlewares.append(self.session_middleware) super().__init__(middlewares=middlewares, *args, **kwargs) + def run(self, *args, **kwargs): - web.run_app(self, *args, **kwargs) + if kwargs.get('port'): + if not kwargs.get('host'): + kwargs['host'] = '127.0.0.1' + web.run_app(self, *args, **kwargs) async def authenticate(self, username, password): return self.basic_username == username and self.basic_password == password