기본 콘텐츠로 건너뛰기

[Flask] 대용량 데이터를 클라이언트로 전송하는 방법

[Flask] 대용량 데이터를 클라이언트로 전송하는 방법

출처: http://flask.pocoo.org/docs/0.12/patterns/streaming/

Basic Usage¶

This is a basic view function that generates a lot of CSV data on the fly. The trick is to have an inner function that uses a generator to generate data and to then invoke that function and pass it to a response object:

from flask import Response @app . route ( '/large.csv' ) def generate_large_csv (): def generate (): for row in iter_all_rows (): yield ',' . join ( row ) + '

' return Response ( generate (), mimetype = 'text/csv' )

from http://dev4u.tistory.com/948 by ccl(A) rewrite - 2020-03-06 21:54:28

댓글

이 블로그의 인기 게시물

Flask 13. pythonanywhere에 배포하기

Flask 13. pythonanywhere에 배포하기 Login: PythonAnywhere It's always a pleasure to hear from you! Ask us a question, or tell us what you love or hate about PythonAnywhere. We'll get back to you over email ASAP. Sorry, there was an error connecting to the server. Please try again in a few moments... www.pythonanywhere.com from http://ohdowon064.tistory.com/124 by ccl(A) rewrite - 2020-03-11 15:54:10

[ubuntu] FLASK_APP

[ubuntu] FLASK_APP Development/Debugging 🐞 FLASK_ENV=development FLASK_APP = app.py flask run zsh: command not found: FLASK_APP ✔️ FLASK_ENV=development FLASK_APP=app.py flask run 띄어쓰기를 해서 저런 오류를 출력할수도 있구나 😲 참고 : 108p에서 FLASK가 FKAS로 오타나있다. from http://hee-stories.tistory.com/18 by ccl(A) rewrite - 2020-03-24 17:20:11