close

[Solved] FastAPI throws an error (Error loading ASGI app. Could not import module “api”)

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error FastAPI throws an error (Error loading ASGI app. Could not import module “api”) in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How FastAPI throws an error (Error loading ASGI app. Could not import module “api”) Error Occurs?

Today I get the following error FastAPI throws an error (Error loading ASGI app. Could not import module “api”) in Python.

How To Solve FastAPI throws an error (Error loading ASGI app. Could not import module “api”) Error ?

  1. How To Solve FastAPI throws an error (Error loading ASGI app. Could not import module “api”) Error ?

    To Solve FastAPI throws an error (Error loading ASGI app. Could not import module “api”) Error I had the same problem and i am solved it adding package name before main, in your case try with uvicorn src.main:app –reload

Solution 1

I had the same problem and i am solved it adding package name before main, in your case try with

uvicorn src.main:app --reload

Solution 2

its typo in “api” check your file name.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment