I'm trying to set up a Heroku-ready Flask app, but I can't figure out how to turn on logging.
Without Foreman, I could create a helloworld app as described in the Flask tutorial:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)
start it like so:
python hello.py
and have logging in stdout.
When I follow the Heroku tutorial, however, there's no app.run
line:
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
app.logger.debug('A value for debugging')
app.logger.warning('A value for warning')
return 'Hello World!'
And so I can't figure out how to run in debug mode and/or get logging output:
foreman start -p 5000
Procfile:
web: gunicorn hello:app