gpt-engineer icon indicating copy to clipboard operation
gpt-engineer copied to clipboard

Error loading ASGI app. Could not import module "main"

Open anilgs opened this issue 1 year ago • 1 comments

Getting the above error while launching the generated application. We are trying to execute the uvicorn main:app --reload command from the projects/[name] folder, whereas it should be uvicorn workspace.main:app --reload since main.py lies inside the projects/[name]/workspace folder.

image

anilgs avatar Jul 03 '23 17:07 anilgs

Thanks for that extra bit of information at the top.

Instead of ~uvicorn main:app --reload. the correct command should be uvicorn workspace.main:app --reloadThis is because main.py is located within theworkspace` flow of the file.

use this updated command:

uvicorn workspace.main:app --reload

with this module parth `workspace.main) you should now be able to use your application without that error loading ASGI.

ALSO make sure you are executing the command from the right directory. Which would be the root direc of your project. (Where you find the projects FOLDER shortly put but that will gurantee that all module paths are resolved correctly if it DOES NOT.

If you still have any issues after that please provide the additional details and error and I will try to test and figure it out - hope this fixes this for you though!

vVv-Keys avatar Jul 04 '23 11:07 vVv-Keys

Closing this answered issue since it has been stale for a long time.

ATheorell avatar Sep 04 '23 09:09 ATheorell