from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('06-index.html')
@app.route('/signup')
def signup_form():
return render_template('06-Sign-up.html')
@app.route('/thankyou')
def thank_you():
first = request.args.get('first')
last = request.args.get('last')
return render_template('06-thankyou.html', first=first, last=last)
@app.errorhandler(404)
def page_not_found(e):
return render_template('06-404.html'), 404
if __name__ == '__main__':
app.run(debug=True)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Puppy Rock</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{{url_for('index')}}">Home Page</a>
</nav>
{% block content %}
{% endblock %}
</body>
</html>
{% extends "06-base.html"%}
{% block content %}
<div class="jumbotron">
<p>Welcome to Puppy Rock!</p>
<p>Wanna sign up for our puppy band?</p>
<a href="{{url_for('signup_form')}}">Sign up for auditions here</a>
</div>
{% endblock %}
{% extends "06-base.html"%}
{% block content %}
<div class="jumbotron">
<h1>Welcome to the sign up page!</h1>
<p>We're excited to have you audition for our band</p>
<p>This will redirect to a thank you page.</p>
<p>
Please note, we're just puppies, so we haven't
learned how to save your information yet!
</p>
<form action="{{url_for('thank_you')}}">
<label for="first">First Name</label>
<input type="text" name="first">
<label for="last">Last Name</label>
<input type="text" name="last">
<input type="submit" value="Submit Form">
</form>
</div>
{% endblock %}
{% extends "06-base.html"%}
{% block content %}
<div class="jumbotron">
<h1>Thank you for signing up {{first}} {{last}}!</h1>
</div>
{% endblock %}
{% extends "06-base.html"%}
{% block content %}
<div class="jumbotron">
<p>Sorry, we couldn't find the page you were looking for.</p>
<p>Cut us some slack, we're just puppies!</p>
</div>
{% endblock %}