Let's go ahead and create the Flask application in a new app.py file:
app = Flask(__name__)
Since our application will use various forms and POST variables, we need to add Cross-Site Request Forgery (CSRF) protection:
csrf = CSRFProtect(app)
To use the Flask-login plugin, we also need to define a SECRET variable and instantiate the login manager:
app.config['SECRET_KEY'] = "THE SECRET"
login_manager = Flask_login.LoginManager()
login_manager.init_app(app)
With that, our Flask app has been created and we can run it with the following code:
Flask run
However, we have not created any routes yet, so for now, all our URLs will result in a 404, Not found error. We will add the /login route in the following paragraphs.