This app can be used to implement multitenant architecture within your django project very easily.
Inorder to install the app
```
pip install djangomultitenant
```
Modify the project settings file as shown below
```
DATABASES = {
'default': {
},
# DB for tenant 1
'akhil': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'akhil.sqlite3'),
},
# DB for tenant 2
'nikhil': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'nikhil.sqlite3'),
}
}
INSTALLED_APPS = [
'djangomultitenant',
]
DATABASE_ROUTERS = [
'djangomultitenant.Router',
]
MIDDLEWARE = [
'djangomultitenant.Middleware', # this has to be the first one
]
```
Use the TENANT-CODE header in all your requests to the django project. You can use [requestly](https://chrome.google.com/webstore/detail/requestly/mdnleldcmiljblolnjhpnblkcekpdkpa?hl=en) to send the headers while accessing project. In the production environment, these headers can be configured in the webservers.
```
TENANT-CODE: akhil
```
Tada !!! You are all equipped with multitenancy !!!
Note: migrations and management commands are not handled by this app. so please dont forget to use --database
Metadata
Release files for djangomultitenant 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| djangomultitenant-0.0.2.tar.gz | 2.3 kB | Without provenance | Details for djangomultitenant-0.0.2.tar.gz |
Release files / djangomultitenant-0.0.2.tar.gz
| Download URL | djangomultitenant-0.0.2.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efaf409d7a7dd040d88b55adf08217a156c4437dcb7071b2e37143a147bee727
|
|
BLAKE2b-256 checksum How to use checksums |
87d857be0aba0c7ab64c00b4edf55a71df8906b9e8504bef19af18305228e3b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for djangomultitenant 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.