return img

@app.route('/get_qrimg')
def get_qrimg():
    img_buf = cStringIO.StringIO()
img = random_qr(url='www.python.org')
img.save(img_buf)
img_buf.seek(0)
return flask.send_file(img_buf, mimetype='image/png')
if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
How to serve a generated QR Image using python's qrcode on Flask