Skip to main content

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

Project description

flask_secure_admin

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.

Development

Uploading the package

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

Usage

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'])
app.register_blueprint(SecureAdminBlueprint(name='Your Project Name'))

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.1.14.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file flask_secure_admin-0.1.14.tar.gz.

File metadata

  • Download URL: flask_secure_admin-0.1.14.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for flask_secure_admin-0.1.14.tar.gz
Algorithm Hash digest
SHA256 3efaa34a0d5ece14ee6ac82fe51c2401e0eddbf45cb0c6c525c12ae09942e4df
MD5 b26fdbc81a2971d1012dd3d194a1a28f
BLAKE2b-256 5d5edacb85134ff5703364cf5ac247f36ea0b3c3251c60c4dbf359bef19238f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page