I have recently gone through this flask tutorial and am now attempting to deploy my application to heroku.
I am able to run the app locally using the command gunicorn "platform:create_app()"
. Due to that command working I added a Procfile which contains web: gunicorn platform.'create_app()'
but when I try to deploy to Heroku I'm receiving the error ModuleNotFoundError: No module named 'platform.create_app()'
.
I searched around and couldn't find a really clear answer to this question, although I think this thread and specifically this answer might help to shed some light.
What I can tell you is that none of the Procfiles I have ever created for Flask apps to deploy in Heroku contained .py
or parentheses.
A typical Procfile for me looks like this:
web: gunicorn app:app
Then in the same directory is the main app file app.py
that contains a line:
app = Flask(__name__)
As far as I can tell the first app
in the command points to the file (module) app.py
, and the second to the variable app
that is defined as Flask(__name__)
.
So for your case the following should work:
web: gunicorn platform:app
Assuming you have a Python module named platform.py
and then inside that file you would need to have a line
app = create_app()
The create_app()
function in the tutorial you referenced returns a Flask
object so that should do the job.