agiliq / building-multi-tenant-applications-with-django Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://books.agiliq.com/projects/django-multi-tenant/en/latest/
Home Page: https://books.agiliq.com/projects/django-multi-tenant/en/latest/
I did everything that was written inside the tutorial and now I got this error:
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tenants'
Hi, this is the most complete document about multitenancy on Django I've have seen.
I like the idea of keeping each tenant in a separated schema, specially for performance, but I don't like subdomains specially for three reasons: additional friction during the registration process, extra SLL costs and exposition of my customer list.
Is there a way to have shared database with isolated schema without subdomains?
Keep up the good work!
Potter migration should depend on potter db not thor db.
When running migrate_schemas all schemas are migrated from Models, however, this way I can not make a table "Master". How to solve it?
Looking at the docker-compose file I noticed that potter_migration
depends on thor_db
.
I'm assuming this is not intentional and it should rather depend on the potter_db
?
potter_db:
image: postgres
environment:
- POSTGRES_PASSWORD=potter
- POSTGRES_USER=potter
- POSTGRES_DB=potter
potter_web:
image: agiliq/multi-tenant-demo
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
depends_on:
- potter_db
environment:
- DATABASE_URL=postgres://potter:potter@potter_db/potter
potter_migration:
image: agiliq/multi-tenant-demo
command: python3 manage.py migrate
volumes:
- .:/code
depends_on:
- thor_db <---- should be potter_db?
environment:
- DATABASE_URL=postgres://potter:potter@potter_db/potter
restrict user data access by tenant_from_request
or create other model with
tenant
user
To restrict user/tenant access to admin
When I run:
python tenant_context_manage.py <my_schema> loaddata <my_fixture>.json
I recept this message:
"Installed 0 object(s) (of 4) from 1 fixture(s)"
The object is find but not migrate to database.
There is a typo error in the Tenant isolation code is intermixed with app code , as litter should be filter .
When using shared-schema
, using of Managers
will be helpful. Should we include/mention about it in the docs ? See the link here https://docs.djangoproject.com/en/2.1/topics/db/managers/. Also, note that, this feature was included in Django 1.8 onwards (May be introduced before that, I remember using it around Django==1.6 or Django==1.8)
The docker compose file has hardcoded containers. How do we add new user containers? Do we just change the docker-compose file through python?
typo in get_tenants_map function in utils.py line 16
def get_tenants_map():
return {"thor.polls.local": "thor", "potter.polls.local": "potter"}
Wanted to raise a PR but cannot push a hotfix branch. Return me a 403.
I have a project configured in this way. Is there any possibility to have a centralized admin panel instead of visiting each domain separately?
Hi,
I am trying to build a multi tenant application by using shared database with isolated schema. I have seen on you read-doc that you have used a function get_tenants_map to keep track of your schema. I would like to know if you have a dynamic solution. Like how should I proceed if I would the user to be able to create his own tenant. What things have to change ?
Thank you very much again for your time guyz!!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.