-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
32 lines (24 loc) · 912 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def home():
return render_template('index.html')
@app.route("/bio")
def bio():
return render_template('bio.html')
@app.route("/contactme", methods=['GET', 'POST'])
def contactme():
error_message = None # Set initial value for error_message
if request.method == 'POST':
# Process the form data and send email
name = request.form.get('name')
email = request.form.get('email')
message = request.form.get('message')
if name and email and message:
# Perform email sending here
return render_template('thank_you.html', name=name)
else:
error_message = "Please fill in all the fields."
return render_template('contactme.html', error_message=error_message)
if __name__ == '__main__':
app.run(debug=True, port=8000)