Authenticating users (Advanced)

So far we have assumed that anyone who can access the sched application should be able to create, display, edit, list, and delete appointment records in the database. Our Flask application needs to authenticate users and protect our database.

Getting ready

We return to the models.py file inside the sched directory of our project.

How to do it...

  1. We start with a database record for the user with a unique e-mail address, in models.py:
    from datetime import datetime from sqlalchemy import Column from sqlalchemy import Boolean, DateTime, Integer, String from sqlalchemy.orm import synonym from sqlalchemy.ext.declarative import declarative_base from werkzeug import check_password_hash from werkzeug import generate_password_hash ...

Get Instant Flask Web Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.