O'Reilly logo

Python 3 Web Development Beginner's Guide by Michel Anders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action authentication using a database

To illustrate how to use database-driven user authentication, run logondbapp.py. It will present you with a logon screen very similar to the one shown in the previous chapter. You may enter the built-in username/password combination of admin/admin, after which you will be presented with a welcoming page.

In order to make this mini application work with the database-driven version of user authentication, all we have to do is replace the reference to an instance of the Logon class to one of the LogonDB class, as highlighted in the following code (the full code is available as logondbapp.py):

Chapter4/logondbdb.py

import cherrypy
import logondb
class Root(object): logon = logondb.LogonDB(path="/logon", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required