Book Image

Flask Framework Cookbook

By : Shalabh Aggarwal
Book Image

Flask Framework Cookbook

By: Shalabh Aggarwal

Overview of this book

Table of Contents (19 chapters)
Flask Framework Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 first recipe and keep building over 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.

We just need to add the following lines to our application's configuration:

from flask.ext.admin import Admin

app = Flask(__name__)

# Add any other application configuration

admin = Admin(app)

Just initializing an application with the Admin class from the Flask-Admin extension will put up a basic admin page, as shown in the following screenshot:

The admin page as created by Flask-Admin

Notice the URL in the screenshot,...