0

I have a Django app that I am hosting on Heroku connected via Github. However, every time I try to start the app, I am receiving the error app[uvicorn.1]: bash: line 1: app/main:app: No such file or directory.

Looking up the problem, it seems that it is in the wrong directory, but even changing the app/main:app location still gives the same error.

The Procfile contents are: uvicorn app/main:app --reload --host 0.0.0.0 --port=${PORT}.

I have attached a screenshot of the file hierarchy as well to help understand the structure.

enter image description here

I tried changing the Procfile to uvicorn main:app --reload --host 0.0.0.0 --port=${PORT} but still received the error: bash: line 1: main:app: command not found

user3324136
  • 415
  • 5
  • 20

1 Answers1

0

After more research, I found that I had formed the Procfile incorrectly. The correct format is web: uvicorn app.main:app --host=0.0.0.0 --port=${PORT:-5000}

The following article was helpful. https://towardsdatascience.com/how-to-deploy-your-fastapi-app-on-heroku-for-free-8d4271a4ab9

user3324136
  • 415
  • 5
  • 20