123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- from flask import Flask, render_template, request, send_file
- from jinja2 import Template
- app = Flask(__name__)
- @app.route('/')
- def homepage():
- return render_template('homepage.html', my_list=[0, 1, 2, 3])
- @app.route('/multiple-buttons')
- def multiple_buttons():
- return render_template('multiple_buttons.html')
- @app.route('/input')
- def input_page():
- return render_template('input.html')
- @app.route('/dropdown')
- def dropdown_page():
- return render_template('dropdown.html')
- @app.route('/iframe')
- def iframe_page():
- return render_template('iframe.html')
- @app.route('/form', methods=['POST', 'GET'])
- def form_page():
- if request.method == 'POST':
- dict = request.form.to_dict()
- print(dict['firstName'])
- return render_template('form.html', post_results=dict)
- else:
- return render_template('form.html', post_results='No form has been submitted yet.')
- @app.route('/pdf')
- def pdf_page():
- return render_template('pdf.html')
- @app.route('/download-pdf')
- def downloadFile():
- path = "uploads/make.pdf"
- return send_file(path, as_attachment=True)
- if __name__ == '__main__':
- app.run('0.0.0.0', 3000)
|