Skip to main content

A bundling of flask-security and flask-admin with a bit of integration.

Project description


My little bundling of flask-admin and flask-security. Drawn heavily from the flask-admin example repo, also integrating sqlsoup because when I made it I didn't want to declare any models. Could be adapted to work with flask-sqlalchemy, surely.


Uploading the package

# Update version number
python sdist
twine upload dist/flask_secure_admin-x.x.x.tar.gz # use the last version created


Run the following from a virtual environment:

pip install flask-secure-admin  # Or use pipenv

Add the following python to your project:

from flask_secure_admin import SecureAdminBlueprint
app.db = SQLSoup(os.environ['DATABASE_URI'])
    name='Your Project Name',

Add sqlsoup models to your admin view by passing a list of their names as a third argument to SecureAdminBlueprint, and a list of view options for customization of these model views as a fourth argument:

    name='Your Project Name',
    models=['videos', 'captions', 'languages'],
    ], {}, {}))

See and its parent class,, for a list of all configuration options.

Last, run this to create necessary database tables in your database (PostgreSQL):

// Turns into, for example: psql yourdatabase < /Users/you/.local/share/virtualenvs/env-aP3G_9r-/lib/python3.7/site-packages/flask_secure_admin/create.sql
psql yourdatabase < $(dirname $(which pip))/../lib/$(python --version | sed 's/..$//' | sed 's/ //' | awk '{print tolower($0)}')/site-packages/flask_secure_admin/create.sql;    

This will create the tables: users, roles, & users_roles, so if you have any of those, this won't work. In that case, you're probably best off making sure you have each of the fields required on users and roles. See the create.sql file for reference.

At this point, you're set! Run your app, there should now be a protected '/admin' route.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_secure_admin-0.2.2.tar.gz (14.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page