Site update and added Feedback page

This commit is contained in:
ookangzheng
2019-08-17 04:34:20 +08:00
parent 5a82df9fee
commit c33427401c
11 changed files with 450 additions and 0 deletions

35
website/feedback/app.py Executable file
View File

@@ -0,0 +1,35 @@
from flask import Flask, render_template, request
from send_mail import send_mail
app = Flask(__name__)
ENV = 'dev'
if ENV == 'dev':
app.debug = True
else:
app.debug = False
@app.route('/')
def index():
return render_template('index.html')
@app.route('/', methods=['POST'])
def submit():
if request.method == 'POST':
customer = request.form['customer']
email = request.form['email']
rating = request.form['rating']
comments = request.form['comments']
# print(customer, rating, comments)
if customer == '' or comments == '' or rating == '':
return render_template('index.html', message='Please enter require fields')
send_mail(customer, email, rating, comments)
return render_template('index.html', message='Thanks for your feedback')
if __name__ == '__main__':
app.run()