Spaces:
Sleeping
Sleeping
File size: 626 Bytes
e5e36db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | """
server/__init__.py
==================
Makes `server` a package while still exposing the FastAPI `app`
defined in the root-level server.py.
We use importlib to load server.py by absolute path, avoiding the
circular-name clash that would occur with a plain `import server`.
"""
import importlib.util
import os
_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
_spec = importlib.util.spec_from_file_location(
"_server_root",
os.path.join(_root, "server.py"),
)
_mod = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_mod)
app = _mod.app # re-export for `from server import app`
|