gunicorn/examples/frameworks/flask_sendfile.py
Benoit Chesneau c16abf922e fix example to work on python3
* fix longpoll example

* fix websocket example

* fix django example

* fix flask exampl
2018-09-04 12:18:05 +02:00

15 lines
291 B
Python

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