gunicorn/examples/frameworks/flask_sendfile.py
2013-08-27 11:45:32 +02:00

15 lines
290 B
Python

import io
from flask import Flask, send_file
app = Flask(__name__)
@app.route('/')
def index():
buf = io.BytesIO()
buf.write('hello world')
buf.seek(0)
return send_file(buf,
attachment_filename="testing.txt",
as_attachment=True)