Загрузить файлы в «app»
This commit is contained in:
25
app/main.py
Normal file
25
app/main.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from app.database import Base, engine
|
||||
from app.routers import api, web
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
Base.metadata.create_all(bind=engine)
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="Robot Management System",
|
||||
description="Прототип веб-системы управления роботами — личный кабинет и API",
|
||||
version="1.0.0",
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
app.include_router(web.router)
|
||||
app.include_router(api.router)
|
||||
Reference in New Issue
Block a user