Locally I have hello.py like this (first code)
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)
Then locally I run
python hello.py
and this works. It listens on port 80 for HTTP connection, and returns 'Hello World!'.
Now, on heroku, the example they give you is (second code)
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
(notice app.run is missing) and they tell you to use a Profile with gunicorn:
web: gunicorn hello:app
This works on heroku.
Now, my question is the following. Because this is part of something much bigger which I have thought out to run as in first code (WITH run.app), I would like to have THAT running on heroku. I would like to be able to run first code on heroku, but it doesn't work. How do I do that?