Skip to main content

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tenantpy-1.0.5-py2.py3-none-any.whl (14.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tenantpy-1.0.5.tar.gz.

File metadata

  • Download URL: tenantpy-1.0.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.2

File hashes

Hashes for tenantpy-1.0.5.tar.gz
Algorithm Hash digest
SHA256 1e78037da5cfff12852f9d73c0a29409935b04b478f13c3a5b312f3b73f360c6
MD5 769549991e754a610f30090f4dcdea6f
BLAKE2b-256 647829e0b0ef7e8dcc914e53ee7eb73205c1b5f27314c53b94e1a6b51c070d21

See more details on using hashes here.

File details

Details for the file tenantpy-1.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: tenantpy-1.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.2

File hashes

Hashes for tenantpy-1.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 386713fa30ea3df5280cd02660a7b411a6c098253f069c4e3115bdbece93096b
MD5 0b1bc1842763d361974d21175a25ede8
BLAKE2b-256 304eee2d8b7e8aa42bf40b9386dcbc4c6a157724343917a4c1f87fb13f545163

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