2/11/2019 - 11:38 AM

Simple Sign up page with form arguments (404 page handling includes)

from flask import Flask, render_template, request
app = Flask(__name__)

def index():
    return render_template('06-index.html')

def signup_form():
    return render_template('06-Sign-up.html')

def thank_you():
    first = request.args.get('first')
    last = request.args.get('last')
    return render_template('06-thankyou.html', first=first, last=last)

def page_not_found(e):
    return render_template('06-404.html'), 404

if __name__ == '__main__':

<!DOCTYPE html>
    <meta charset="utf-8">
    <title>Puppy Rock</title>
    <link rel="stylesheet" href="" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <script src="" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
      <a class="navbar-brand" href="{{url_for('index')}}">Home Page</a>
    {% block content %}
    {% endblock %}
{% 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>
{% 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>
  Please note, we're just puppies, so we haven't
  learned how to save your information yet!
    <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">

{% endblock %}
{% extends "06-base.html"%}
{% block content %}
<div class="jumbotron">

  <h1>Thank you for signing up {{first}} {{last}}!</h1>
{% 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>
{% endblock %}