Using the Flask-Admin extension
Flask-Admin
is an available extension that helps in the creation of admin interfaces for our application in a simpler and faster way. All the subsequent recipes in this chapter will focus on using and extending this extension.
Getting ready
First, we need to install the Flask-Admin
extension:
$ pip install Flask-Admin
We will extend our application from the previous recipe and keep building on the same.
How to do it…
Adding a simple admin interface to any Flask application using the Flask-Admin
extension is just a matter of a couple of statements.
Simply add the following lines to the application’s configuration in my_app/__init__.py
:
from flask_admin import Admin app = Flask(__name__) # Add any other application configurations admin = Admin(app)
You can also add your own views to this; this is as simple as adding a new class as a new view that inherits from the BaseView
class, as shown in the following code block...