how to make downloadable file in flask

Solutions on MaxInterview for how to make downloadable file in flask by the best coders in the world

showing results for - "how to make downloadable file in flask"
Dante
04 Jan 2020
1from flask import Flask
2from flask import send_file
3app = Flask(__name__)
4
5@app.route('/download')
6def downloadFile ():
7    #For windows you need to use drive name [ex: F:/Example.pdf]
8    path = "/Examples.pdf"
9    return send_file(path, as_attachment=True)
10
11if __name__ == '__main__':
12    app.run(port=5000,debug=True) 
Tiberius
16 Apr 2017
1# Example of job definition:
2# .---------------- minute (0 - 59)
3# |  .------------- hour (0 - 23)
4# |  |  .---------- day of month (1 - 31)
5# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
6# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
7# |  |  |  |  |
8# *  *  *  *  * user-name  command to be executed
9
10# Set the hardware clock to keep it in sync with the more accurate system clock
1103 05 * * * /sbin/hwclock --systohc
12
13# Perform monthly updates on the first of the month
14# 25 04 1 * * /usr/bin/dnf -y update