Begin building contact form
This commit is contained in:
17
src/contact.py
Normal file
17
src/contact.py
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
from index import app
|
||||
from os import environ
|
||||
from flask import request, redirect, render_template
|
||||
|
||||
|
||||
|
||||
@app.route('/contact/', methods=('GET', 'POST'))
|
||||
def contact():
|
||||
if request.method == 'POST':
|
||||
discord_hook = environ['DISCORD_WEBHOOK']
|
||||
print(discord_hook)
|
||||
print(request.form)
|
||||
return redirect('/contact/')
|
||||
else:
|
||||
return render_template('contact.html')
|
@@ -5,6 +5,7 @@ from flask import Flask, render_template, Response
|
||||
app = Flask(__name__)
|
||||
|
||||
import projects
|
||||
import contact
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
|
16
src/templates/contact.html
Normal file
16
src/templates/contact.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% include 'header.html' %}
|
||||
<main>
|
||||
<h2>Contact Me</h2>
|
||||
<p>Got a question or want to talk about something on this site? Drop me a message below:</p>
|
||||
|
||||
<form action="#" method="post">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" name="name">
|
||||
<label for="email">Email Address:</label>
|
||||
<input type="email" name="email">
|
||||
<label for="message">Message:</label>
|
||||
<textarea name="message"></textarea>
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
</form>
|
||||
</main>
|
||||
{% include 'footer.html' %}
|
Reference in New Issue
Block a user