pip install DBNavigator
from flask import Flask
from db_navigator import DBNavigator
app = Flask(__name__)
DBNavigator(app, "users.db", prefix="/admin", password="1234")
### Your Flask app
app.run(debug=True)
app |
Flask app |
file |
Target database local file |
prefix |
Route prefix |
password |
Access password |
login_func |
Custom login function |
readonly |
Default editable |
db_engine |
Default is SQLite |
Must be returned True
for access.
It is recommended to save the password from the database in memory because it will be checked before each request.
def custom_login(password):
# make request to db
if password == "custom_value":
return True
DBNavigator(app, "users.db", login_func=custom_login)
A class that should inherit from the abstract class DataBaseInterface
and implement all its functions.
from db_navigator.databases import DataBaseInterface
class YourDBEngine(DataBaseInterface):
def __init__(self, *args):
super().__init__(*args)
self.__name__ = "Your DB Engine name"
Donatello | |
Donation Alerts |