ImportError в Python
Есть приложение на fastapi. Перенёс основной функционал приложения в папку books
, и в случае импорта в main.py
возникает ImportError
.
Вот мой код:
from books import books_router
from fastapi import FastAPI
from auth import auth_router
from redis import asyncio as aioredis
from fastapi_cache import FastAPICache
from fastapi_cache.backendsвведите сюда код`.redis import RedisBackend
app = FastAPI()
app.include_router(auth_router.router, prefix="/auth", tags=["auth"])
app.include_router(books_router.router, prefix="/books", tags=["books"])
@app.on_event("startup")
async def startup_event():
redis = aioredis.from_url("redis://localhost", encoding="utf8", decode_responses=True)
FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
Вот ошибка:
File "f:\programming\simpleCRUDInFastAPI\app\main.py", line 1, in <module>
from books import books_router
И структура проекта: