flask.helpers send_file Example Code

send_file is function in the Flask flask.helpers module. send_file transfers the contents of a file to the client using the most efficient method available and configured in the Flask settings. It attempts to guess the correct mimetype to use but it can also be explicitly configured.

Note that send_file is usually imported directly from flask instead of from flask.helpers, even though it is defined within the helpers module. It's the same function that is imported, but it's less characters to type when you leave off the .helpers part.

flash, get_root_path, make_response, safe_join, and url_for are several other callables with code examples from the same flask.helpers package.

Example 1 from CTFd

CTFd (homepage) is a capture the flag (CTF) hacking web app built with Flask. The application can be used as-is to run CTF events, or modified for custom rules for related scenarios. CTFd is open sourced under the Apache License 2.0.

CTFd / CTFd / views.py

Example 2 from Flask-VueJs-Template

Flask-VueJs-Template (demo site) is a minimal Flask boilerplate starter project that combines Flask, Vue.js, and Flask-RESTPlus. The project provides some sensible defaults that are easy to continue building on, and the source code is open source under the MIT license.

Flask-VueJs-Template / app / init.py