app.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from flask import Flask, render_template, request, send_file
  2. from jinja2 import Template
  3. app = Flask(__name__)
  4. @app.route('/')
  5. def homepage():
  6. return render_template('homepage.html', my_list=[0, 1, 2, 3])
  7. @app.route('/multiple-buttons')
  8. def multiple_buttons():
  9. return render_template('multiple_buttons.html')
  10. @app.route('/input')
  11. def input_page():
  12. return render_template('input.html')
  13. @app.route('/dropdown')
  14. def dropdown_page():
  15. return render_template('dropdown.html')
  16. @app.route('/iframe')
  17. def iframe_page():
  18. return render_template('iframe.html')
  19. @app.route('/form', methods=['POST', 'GET'])
  20. def form_page():
  21. if request.method == 'POST':
  22. dict = request.form.to_dict()
  23. print(dict['firstName'])
  24. return render_template('form.html', post_results=dict)
  25. else:
  26. return render_template('form.html', post_results='No form has been submitted yet.')
  27. @app.route('/pdf')
  28. def pdf_page():
  29. return render_template('pdf.html')
  30. @app.route('/download-pdf')
  31. def downloadFile():
  32. path = "uploads/make.pdf"
  33. return send_file(path, as_attachment=True)
  34. if __name__ == '__main__':
  35. app.run('0.0.0.0', 3000)