diff --git a/blurry/__init__.py b/blurry/__init__.py index 916288d..9f424eb 100644 --- a/blurry/__init__.py +++ b/blurry/__init__.py @@ -177,7 +177,8 @@ def runserver(): SETTINGS["RUNSERVER"] = True - event_loop = asyncio.get_event_loop() + event_loop = asyncio.new_event_loop() + asyncio.set_event_loop(event_loop) event_loop.create_task(build(release=False)) jinja_env = get_jinja_env() diff --git a/blurry/async_typer.py b/blurry/async_typer.py index b3f2497..120cc92 100644 --- a/blurry/async_typer.py +++ b/blurry/async_typer.py @@ -10,7 +10,8 @@ def decorator(async_func): # Convert async function to synchronous @wraps(async_func) def sync_func(*_args, **_kwargs): - loop = asyncio.get_event_loop() + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) return loop.run_until_complete(async_func(*_args, **_kwargs)) # Register synchronous function