我无法正确理解1.methods = ['GET','POST']和2.request.method =='POST'
所执行的操作@app.route("/contact",methods = ['GET','POST'])
def contact1():
if(request.method == 'POST'):
'''adding entery to database'''
name = request.form.get('name')
email = request.form.get('email')
phone = request.form.get('phone')
message = request.form.get('message')
entry = Contacts(name = name,email = email,msg=message,phone_num = phone,date = datetime.now())
db.session.add(entry)
db.session.commit()
mail.send_message('New message from '+ name,
sender = email,
recipients = [params['gmail-user']],
body = message + "\n" + phone
)
return render_template('contact.html',params = params)