diff --git a/anonstream/__init__.py b/anonstream/__init__.py index 28e3060..575073f 100644 --- a/anonstream/__init__.py +++ b/anonstream/__init__.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2022 n9k # SPDX-License-Identifier: AGPL-3.0-or-later +import asyncio import json from collections import OrderedDict @@ -76,6 +77,10 @@ def create_app(toml_config): @app.before_serving async def startup(): + # Create routes and background tasks + import anonstream.routes + import anonstream.tasks + # Start control server if app.config['SOCKET_CONTROL_ENABLED']: from anonstream.control.server import start_control_server_at @@ -94,8 +99,4 @@ def create_app(toml_config): ) app.add_background_task(start_event_server) - # Create routes and background tasks - import anonstream.routes - import anonstream.tasks - return app