1df4b11aef
CI / lint-test-build (push) Failing after 1m7s
- Introduced new HTML templates for the dashboard, metrics, overview, and backtesting functionalities. - Implemented partial templates for metrics, overview, audit, controls, and charts to enhance modularity. - Updated the Jinja2 template resolution logic to support different deployment environments. - Added a health check template to display the service status. - Included a test suite to verify the template resolution logic. - Updated `pyproject.toml` to include new HTML templates in the package data.
42 lines
869 B
Python
42 lines
869 B
Python
from __future__ import annotations
|
|
|
|
import platform
|
|
from importlib import import_module
|
|
|
|
import uvicorn
|
|
|
|
from arbitrade.api.app import create_app
|
|
from arbitrade.config.settings import get_settings
|
|
|
|
|
|
def _install_uvloop_if_available() -> None:
|
|
if platform.system() == "Windows":
|
|
return
|
|
|
|
try:
|
|
uvloop = import_module("uvloop")
|
|
uvloop.install()
|
|
except Exception:
|
|
# App can still run with default asyncio loop.
|
|
return
|
|
|
|
|
|
def main() -> None:
|
|
_install_uvloop_if_available()
|
|
|
|
settings = get_settings()
|
|
app = create_app(settings)
|
|
|
|
uvicorn.run(
|
|
app,
|
|
host=settings.app_host,
|
|
port=settings.app_port,
|
|
log_level=settings.log_level.lower(),
|
|
loop="uvloop" if platform.system() != "Windows" else "asyncio",
|
|
http="httptools",
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|