1

I was wondering if it is possible/necessary to indicate in the Procfile that app.py is in another directory. For example, my directory is like this:

root
│   Procfile
|
└───backend
│   │   app.py

Should the Procfile be

web: gunicorn app:app

like usual? Or is there something that indicates app.py is in the backend directory? Any help is appreciated

b d
  • 19
  • 1

1 Answers1

1

I have the same problem, I solved:

  1. Create another file in the root folder like "main.py"

main.py:

from backend.app import app                                                               
if __name__ == "__main__":                                             
    app.run(debug=True)
  1. Change ".env" file
FLASK_APP=main.py
  1. change Procfile
web: gunicorn main:app

directory now look like this:

root
│   Procfile
|   .env
|   main.py
└───backend
│   │   app.py

IT works for me I hope it works for you.

Ayush Rana
  • 31
  • 3