flask console log print code example
Example 1: flask console log
from __future__ import print_function # In python 2.7
import sys
@app.route('/button/')
def button_clicked():
print('Hello world!', file=sys.stderr)
return redirect('/')
Example 2: flask print to console
import sys
print('This is error output', file=sys.stderr)
print('This is standard output', file=sys.stdout)