Tenant Management For Web Application
Project description
Tenant Management For Web Application
- Database Tenant Isolation
- Cache Tenant Isolation
- Customize Addons Tenant Meta Data Inject
e.g:
import flask
from flask import Flask
import json
import peewee
from tenantpy.contrib import flask as flask_tenc
app = Flask(__name__)
class User(flask_tenc.BaseModel):
englishName = peewee.CharField()
email = peewee.CharField()
class ConfigManager(flask_tenc.ConfigManager):
def get_config(self, key: flask_tenc.ConfigKeys):
# get config by any
@app.route("/random")
def random_pet():
"""A cute furry animal endpoint.
---
get:
description: Get a random pet
security:
- ApiKeyAuth: []
responses:
200:
description: Return a pet
content:
application/json:
schema: PetSchema
"""
# Hardcoded example data
flask.g.database.begin()
ins = User.get()
flask.g.database.rollback()
pet_data = {
"name": ins.englishName,
}
return flask.Response(json.dumps(pet_data), content_type="application/json")
flask_tenc.init_app(app, ConfigManager())
app.run()
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
tenantpy-1.0.5.tar.gz
(9.2 kB
view hashes)
Built Distribution
Close
Hashes for tenantpy-1.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 386713fa30ea3df5280cd02660a7b411a6c098253f069c4e3115bdbece93096b |
|
MD5 | 0b1bc1842763d361974d21175a25ede8 |
|
BLAKE2b-256 | 304eee2d8b7e8aa42bf40b9386dcbc4c6a157724343917a4c1f87fb13f545163 |