I am trying to setup an app using FastAPI but keep getting this error which I can't make sense of. My main.py file is as follows:
from fastapi import FastAPI
from app.routers import test
app = FastAPI()
app.include_router(test, prefix="/api/v1/test")
And in my routers/test.py file I have:
from fastapi import APIRouter, File, UploadFile
import app.schemas.myschema as my_schema
router = APIRouter()
Response = my_schema.Response
@router.get("/", response_model=Response)
def process(file: UploadFile = File(...)):
# Do work
But I keep getting the following error:
File "/Users/Desktop/test-service/venv/lib/python3.8/site-packages/fastapi/routing.py", line 566, in include_router for route in router.routes: AttributeError: module 'app.routers.test' has no attribute 'routes' python-BaseException
I cant make sense of this as I can see something similar being done in the sample app here.