[crawler]
This commit is contained in:
27
crawler_platform/app/main.py
Normal file
27
crawler_platform/app/main.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import FileResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from crawler_platform.app.api.routes import register_routes
|
||||
from crawler_platform.app.core.database.session import init_db
|
||||
|
||||
|
||||
DATABASE_URL = os.getenv("CRAWLER_DATABASE_URL", "sqlite:///crawler_platform.db")
|
||||
STATIC_DIR = Path(__file__).parent / "web" / "static"
|
||||
|
||||
app = FastAPI(title="Ontology Crawler Platform", version="0.1.0")
|
||||
init_db(DATABASE_URL)
|
||||
register_routes(app, DATABASE_URL)
|
||||
|
||||
if STATIC_DIR.exists():
|
||||
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|
||||
|
||||
|
||||
@app.get("/", include_in_schema=False)
|
||||
def admin_ui():
|
||||
return FileResponse(STATIC_DIR / "index.html")
|
||||
Reference in New Issue
Block a user