Oflex
O(pinionated) fl(ask) ex(tensions).
Flask login and connection-pooling stuff that I reuse in all my prototyping. The one-line goal of this project is to have drop-in login, however inflexible, rather than spending 6 hours setting it up every time.
This is only compatible with my postgres / redis stack and a similar DB users schema.
Will happily add docs if anyone else needs this, post a github issue to LMK.
Features
These things wouldn't normally belong together and are only bound together by the common themes of (1) me needing them every time (2) I haven't found a right-fit library to do any of them in flask (3) they're all difficult to integrate automatically without some schema / template / backend assumptions.
- flask blueprints for create-account and login pages
- and scrypt passwords
- and twilio login
- login-required decorator which populates
flask.g.session - graphene / graphql middleware login-required
- HSTS middleware
- postgres & redis initializer
- postgres connection pool context manager
- basic RBAC
- werkzeug remote IP
- in-memory and redis rate limiting
- email verification
- invitations & preapproval lists
- oauth
- add sample schema
What you should do to use this
- Look in
config.pyin this repo and make sure your SQL users table and environment variables conform to what this package expects. - (You can customize the configs, but that's a waste)
- use
flask.current_app.poolorpool.withcon, andflask.current_app.redisin your thing - You have a base.htm template that defines styles, headers, etc
Consider also
These other flask login libraries that I haven't evaluated at all:
- https://github.com/mattupstate/flask-security
- https://github.com/lingthio/Flask-User
- https://github.com/maxcountryman/flask-login
There are a lot of these because schema integration is difficult.