Creating a sign-up page

We will start these new features by adding the ability for new users to sign up. In web_server.py, add the following new class:

class SignUpView(MethodView): 
 
    def get(self): 
        return render_template('sign_up.html') 

This new SignUpView class will be responsible for dealing with the sign-up process. We've added a get method, which will simply render the sign_up.html template that we will create later.

At the end of the web_server.py module, create the following URL rule:

app.add_url_rule( 
    '/sign_up', view_func=SignUpView.as_view('sign_up') 
) 

As you probably already know, this will direct all requests to /sign_up to our new SignUpView class.

Now let's create our new template. In the templates folder, create a new file, ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.