Skip to content
Discussion options

You must be logged in to vote

The answer I was searching for is here: You can actually start it the way I wanted it, but make sure to name it correctly:

uvicorn.run("main:app", host='0.0.0.0', port=8127, workers=2)
ERROR:    Error loading ASGI app. Could not import module "main".

raises Error because the file is not named main.py! If you have it as my_fastapi_server.py, you run it as follows:

uvicorn.run("my_fastapi_server:app", host='0.0.0.0', port=8127, workers=2)

Replies: 17 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@timhughes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
Converted from issue

This discussion was converted from issue #1495 on February 28, 2023 08:46.