Тёмный

How to get Django Tenants up and running (old) 

Tom's Python and Django
Подписаться 723
Просмотров 11 тыс.
50% 1

This video has been replaced please see • How to get Django Tena... for the new version.
This video explains how you can use PostgreSQL schemas with Django using the Django Tenant library.

Опубликовано:

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 121   
@roficakep
@roficakep 5 лет назад
Thank Tom! for next step can you show me how to create rest api using django-tenant. and whether basic concepts such as relations can be applied here
@IllevensKO
@IllevensKO 3 года назад
PLEASE FOR THE LUV OV LARD SOMEONE SHOW US HOW TO USE IT WITH DRF
@SadaqatullahNoonari
@SadaqatullahNoonari 5 лет назад
Keep it up.. your voice matches the authority required on teaching. create MOAR
@a-raheemjamaal5564
@a-raheemjamaal5564 5 лет назад
Really appreciate your work. I'm trying to get django tenants up with a custom user model. Should the custom User Model be in both tenant and shared apps or only in the shared apps?
@egbertschroeder4497
@egbertschroeder4497 5 лет назад
I have the same question. I am running into an error when I want to migrate_schemas saying my users_user relationship doesn't exist.
@eduardolucas391
@eduardolucas391 5 лет назад
Thank you! That was brilliant.
@jaredtangir7784
@jaredtangir7784 5 лет назад
Thanks for this! So helpful! Can you share what your hosts file on your mac looks like? what is the format i should use to add the subdomains?
@tomspythonanddjango6269
@tomspythonanddjango6269 5 лет назад
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 127.0.0.1 www.dtdemo.local 127.0.0.1 t1.dtdemo.local 127.0.0.1 t2.dtdemo.local 127.0.0.1 t3.dtdemo.local 127.0.0.1 t4.dtdemo.local
@jaredtangir7784
@jaredtangir7784 5 лет назад
@@tomspythonanddjango6269 Many thanks!! I was writing it backwards
@joshequichi
@joshequichi 5 лет назад
How I can do it on Windows? Please. Thank You.
@juanbetancourt5106
@juanbetancourt5106 5 лет назад
@@joshequichi Find host file at 'C:\Windows\System32\drivers\etc', copy it to the desk and edit there, then replace the last file for original file
@joshequichi
@joshequichi 5 лет назад
@@juanbetancourt5106 so much thanks!
@thefamousdjx
@thefamousdjx 4 года назад
Thanks a lot. This complements the docs real well as they are not very straighforward and interactive tutorial just throws errors
@after6097
@after6097 5 лет назад
Hi Tom, Thanks for this video. At last I found it after so long been searching for it. Please create a complete multi tenant app. BR, I am Nyoman, from Bali, Indonesia
@juanbetancourt5106
@juanbetancourt5106 5 лет назад
Its pretty clever, please continue your videos
@PavithraSuLa
@PavithraSuLa 4 года назад
Thanks, Tom for sharing this tutorial. I am looking for a solution to use URL parameters instead of subdomains. Eg: tenant app 1 - 127.0.0.1:8000/tenant/1/..... tenant app 2 - 127.0.0.1:8000/tenant/2/..... can you please help me?
@tomspythonanddjango6269
@tomspythonanddjango6269 4 года назад
You need to use the latest version of django tenants and you will find a example project
@poormancodespmc4598
@poormancodespmc4598 3 года назад
Was you able to make it work the way you wanted?
@poormancodespmc4598
@poormancodespmc4598 3 года назад
@@tomspythonanddjango6269 Thank you. I am unable to make make the subdomains work on Heroku. I am not very deep in this area. I have built an awesome API with Django-Tenants/Django rest_framework and I have also added Django channels. After some sweats, I have it on Heroku and I can access the public domain. But I am not able to access any tenant-specific domain like famv.my-app.herokuapp.com (I don't pay yet for more dynos). Can you please share an idea with me to make the subdomains work? Thank you for your help.
@poormancodespmc4598
@poormancodespmc4598 3 года назад
@@tomspythonanddjango6269 I make it work wow. I have learned so much by deploying an api powered by Django/Django-tenants/Django-channels and make it work I feel like making a video tutorial about the process. hahah that was cool
@taabishansari9649
@taabishansari9649 2 года назад
@@poormancodespmc4598 Hey brother, I am trying to create a multi tenant application but not able to access the apis by the other computer on the same network. Please help if you know anything about this.
@magnaldomelo7005
@magnaldomelo7005 5 лет назад
Hello Tom's Is it possible to implement this solution for a rest application? Using the django-rest-framework framework Thank you!
@poormancodespmc4598
@poormancodespmc4598 4 года назад
I am using it with djangoresframework. It works great.
@victorisaac8331
@victorisaac8331 3 года назад
@@poormancodespmc4598 Do you mind sharing
@poormancodespmc4598
@poormancodespmc4598 3 года назад
@@victorisaac8331 unfortunstely not, sorry bro. Let me know how I can't help you integrate them.
@IllevensKO
@IllevensKO 3 года назад
Man, I'm simultaneously very thankful and pissed at this, hours later, and still can't get it to work. Please add to the description that you need to install Postgres (and whether inside or outside of venv). Also at 10:05 you mention something you did outside of the tutorial but which is crucial to it, wtf, who does that >:(
@IllevensKO
@IllevensKO 3 года назад
maybe I'm just curvy-handed. Either way thank you for helping others and contributing to open source community.
@IllevensKO
@IllevensKO 3 года назад
ok so in your hostfile, did you put: 127.0.0.1 t1.dtdemo.local 127.0.0.1 t2.dtdemo.local etc or is there a way to open it up for all subdomains?
@poormancodespmc4598
@poormancodespmc4598 4 года назад
Hi Tom. Thank you for the great package Django-tenants. I am implementing a project with it, a saas app. The challenge I am facing now is to give the clients the possibility to add their own apps. What I mean, I could allow the client X to add an app "Finance management", but when I will append the new app in the Tenants apps list, it will be available for all the other clients, not just the client X. That behavior would be annoying for the other clients who are not necessarily interested in it. Is there a way to do that with Django-tenants now? Just like Salesforce does, give the opportunity to add app/objects/tabs and so on for a specific client. I can create the logic for that the only concern is how to display the app only for the client who created it not all the clients. I hope the question is clear and you will find a moment to help me. Greetings from Haiti!
@thomasturner2279
@thomasturner2279 4 года назад
Not sure. I personal just unlock parts of my app with a table of add ons. However every tenant still gets all the database tables even if they don't need them. I hope this helps
@WanjohiKibui
@WanjohiKibui 5 лет назад
Thanks for this great tutorial. Have a question, I developed my project based on this tutorial. I need to integrate celery so as to send reminders weekly or daily to each tenant. E.g If a tenant has a ToDo due tomorrow, the specific tenant gets the notification and the others don't. Any material I can use for such? Thanks in advance.
@youssefjaber6885
@youssefjaber6885 5 лет назад
This a wonderful video. It worked like a charm. Thank you very much. Would you please make a video on how to add users to be linked from person to Django User as OneToOne relationship. Thanks again.
@dhs1210
@dhs1210 4 года назад
Thanks you very much Tom , really Great work
@dhwajguptaiitr
@dhwajguptaiitr 3 года назад
If you are watching this in 2021 and you see the error while migrating, Please Downgrade your Django Version to 3.0.11
@wombstrat9116
@wombstrat9116 3 года назад
awesome work, thanks!
@mhashmi3593
@mhashmi3593 4 года назад
Good One Tom. If you can extend this app with user login/multi dashboard you will rock the RU-vid. Quality content related to SaaS don't exist for django on RU-vid.com.
@thomasturner2279
@thomasturner2279 4 года назад
I am planning to add more RU-vid videos
@hunarb.mohammed9189
@hunarb.mohammed9189 2 года назад
how to add different logos for different tenants please ?
@janakisasidhar7582
@janakisasidhar7582 3 года назад
Hello, is it possible to have common user table for one or more tenants ...like user table in a seperate schema like in public schema maybe ?
@thefamousdjx
@thefamousdjx 4 года назад
Hi could you explain why in your case you left out the TenantAdminMixin when registering in admin as the docs include it: class ClientAdmin(TenantAdminMixin, admin.ModelAdmin). I followed your example and everything works fine but I realised I get errors if I include this TenantAdminMixin on trying to add Persons to any tenants. Is there any issues with leaving the mixin out?
@angieximenavalerianocarden37
@angieximenavalerianocarden37 4 года назад
thank you!! was perfect :D
@m.yoganrajyogan8797
@m.yoganrajyogan8797 4 года назад
That was pretty clear.
@a5si5
@a5si5 4 года назад
Hi Tom! I can't serve my app on Apache using mod_wsgi daemon mode. It works running at runserver mode test. The Apache configuration in the docs didn't work for me. Do you have any help? Thanks for the video!
@IllevensKO
@IllevensKO 3 года назад
Please, could anyone share how they managed to make a view for registering a tenant and it's superuser ?! I've been struggling with this for days, with or without DRF , idk what to do... I have already managed to write a signal to create both tenant and superuser but still don't know how to give superuser a password !
@apoorva.pandey
@apoorva.pandey 4 года назад
You used set for INSTALLED_APPS but set is unordered and order matters in case of INSTALLED_APPS.
@eliere_de_oliviere
@eliere_de_oliviere 3 года назад
Thank you!
@sionfongokone6488
@sionfongokone6488 3 года назад
@Tom, have you a LinkedIn profile ?
@codeclockyt
@codeclockyt 5 лет назад
How can i have an auth user that will be responsible for creating Clients (tenants) dynamically ?
@FernandoCordeiroDr
@FernandoCordeiroDr 5 лет назад
This is very timely indeed! I'm trying to get django tenants up with allauth and boy, I have sooooo many questions! For instance, in the docs, the auth and session apps are only in the SHARED_APPS, but here they show also in TENANT_APPS as well. What is the consequence/reason of doing this?
@tomspythonanddjango6269
@tomspythonanddjango6269 5 лет назад
Fernando Cordeiro the tenant_apps are the ones for the tenants only
@FernandoCordeiroDr
@FernandoCordeiroDr 5 лет назад
@@tomspythonanddjango6269 Yes, that I got... it's the behavior of the apps appearing twice that confuse me. Like auth, for instance: does it mean I can have users that are global across all tenants and users that are tenant-specific?
@tomspythonanddjango6269
@tomspythonanddjango6269 5 лет назад
Fernando Cordeiro yes and no to the users in the public. The problem is if you go both is that users will have the same is as the tenant users gets. Personally I would have the users only in the tenant. There is a project called django tenant users which is worth looking at I don’t use it however I know lots do.
@FernandoCordeiroDr
@FernandoCordeiroDr 5 лет назад
@@tomspythonanddjango6269 The same 'is'? :P
@tomspythonanddjango6269
@tomspythonanddjango6269 5 лет назад
Fernando Cordeiro for django tenant to work django and python are the same as if you didn’t use django tenants
@stej2248
@stej2248 3 года назад
Tq, I have doubt. How can we use json data for tenants instead of tenant model which is declared in settings (TENANT_MODEL)
@thomasturner2279
@thomasturner2279 3 года назад
You can't do that
@stej2248
@stej2248 3 года назад
@@thomasturner2279 Thank you so much for your reply. I've asked this to many of the people but you have only replied. I like to have contact with you for learning django. Shall i contact you through mail or skype. Kindly reply for this post also. If you are ok i'll give my skype id to you. Once again thanks for ur support.
@apeironsupport5015
@apeironsupport5015 4 года назад
thanks tom
@ladyking83
@ladyking83 4 года назад
Hallo Tom thanks to you i could implement multitenancy in django, but how to get my frontend (vue.js) to understand the tenant domains? in other word how to enable the frondend to serve all the other domains? any idea or a reference page that could help? thanks a lot!
@amintalukder8583
@amintalukder8583 4 года назад
Hi Mannar, I am doing the same using vue as my frontend and django-tenants as backend with postgres, working with some api, kind of not able to completely figure out the steps. if you wish, we can collaborate - gs_amin_iut@yahoo.com
@ladyking83
@ladyking83 4 года назад
@@amintalukder8583 Hello Amin, i figured it out, in my Vue Frontend there is something called base url, there i can inject the domain: t1.my-domain.com. Thanks :)
@ladyking83
@ladyking83 4 года назад
i figured it out, in my Vue Frontend there is something called base url, there i can inject the domain: t1.my-domain.com. Thanks :)
@piyushraj186
@piyushraj186 4 года назад
@@amintalukder8583 , i was also trying out django tenants with DRF to create Apis and you please help me in this case ?
@amintalukder8583
@amintalukder8583 4 года назад
@@piyushraj186 yes please let me know how can I help you.
@zahidaliMughal
@zahidaliMughal 5 лет назад
Please can you guide me how to create a tenant from web page rather then using create_tenant from command line
@jaredtangir7784
@jaredtangir7784 5 лет назад
@zahid have you had success with this? I am trying to figure out the same thing
@zahidaliMughal
@zahidaliMughal 5 лет назад
@@jaredtangir7784 no I could not
@JoshDavies89
@JoshDavies89 4 года назад
Just add a CreateView? Or a function based view and overtide the form_valid(). Then just create the objects that way. The tenant shema gets created when you call the save method.
@erdem.demirci
@erdem.demirci 4 года назад
Is this approach scalable ? If limited , any advice for tenant limit ? Thanks
@thomasturner2279
@thomasturner2279 4 года назад
As far as I know there are no limits. However it does depend on your computer hardware.
@erdem.demirci
@erdem.demirci 4 года назад
Thanks @@thomasturner2279 Here it is claimed that your approach is not scalable. Am I missing something ? ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RKSwjaZKXL0.html Is it really just only the shared table architecture scalable?
@thomasturner2279
@thomasturner2279 4 года назад
@@erdem.demirci I will watch it later however from what I see he is wrong. The problem with shared architecture is that you have to put a ID of some kind in a lot of tables and there is more chance of data being seen by another client. Years ago I have designed systems like this and it was a nightmare! With tenants you isolate the data of each customer and is easier to manage.
@erdem.demirci
@erdem.demirci 4 года назад
@@thomasturner2279 For now, scalability is more important than isolation, so my concern is whether your approach is scalable. Is "Django-tenants" suitable for scaling? Meanwhile, we look forward your video series to learn more . Thanks
@thomasturner2279
@thomasturner2279 4 года назад
@@erdem.demirci Yes it is scalable
@nabeelahmed2574
@nabeelahmed2574 4 года назад
It's possible to add 2 different subdomain for same tenant
@thomasturner2279
@thomasturner2279 4 года назад
Yes That is what the domain model is for
@nabeelahmed2574
@nabeelahmed2574 4 года назад
@@thomasturner2279 but sir I can't get any logic for this please give me suggestions how to this and thanks for your response 😊
@zahidaliMughal
@zahidaliMughal 5 лет назад
I did the same. Everything is ok. server is running without any error. but my page is not opening. Request Method: GET Request URL: 127.0.0.1:8000/ No tenant for hostname "127.0.0.1" These errors are showing
@tomspythonanddjango6269
@tomspythonanddjango6269 5 лет назад
You need to use a host name not 127.0.0.1
@zahidaliMughal
@zahidaliMughal 5 лет назад
Thanks a lot. You are my teacher. I learnt a lot from your videos and posts
@piyushraj186
@piyushraj186 4 года назад
I have question about auth.user user model, where should i put them in shared apps or tenant apps ??
@danieldarko6495
@danieldarko6495 4 года назад
both , it still works
@piyushraj186
@piyushraj186 4 года назад
Thanks for reply. So for a tenant, user will exist in both tenant and public schema ??
@danieldarko6495
@danieldarko6495 4 года назад
@@piyushraj186 Yes,
@thomasturner2279
@thomasturner2279 4 года назад
Personal in my app I have them in both apps.
@schults64
@schults64 3 года назад
Thank you for your tutorial ! It really helped me, but I'm having trouble to access my server. My domain's name is: test.local. When I type test.local:8000 on the browser. I'm using swagger api to document my API. Can you please help me?
@thomasturner2279
@thomasturner2279 3 года назад
you either got to change the host file. Or you anything at localhost ie demo.localhost
@schults64
@schults64 3 года назад
@@thomasturner2279 thank you very much ! Yesterday I saw one of your answers here showing how was your host file and I managed to do mine here. Can you please tell me, how can I redirect the tenant to its host after user registration? I’m getting the error like the tenant wasn’t created (but it was, I checked at database) and the page is not redirected. Appreciate any help
@ianoliveiradev
@ianoliveiradev 4 года назад
waesome!!
@pierregarcia8083
@pierregarcia8083 4 года назад
Where is person.html located?
@thomasturner2279
@thomasturner2279 4 года назад
Your settings file should say where your templates go.
@dan_isaza_dev
@dan_isaza_dev 3 года назад
You can put person.html in a folder called `templates` that is inside of `myclientapp`. Make sure to include an empty file called `__init__.py` inside of `templates` so that django can discover it. So, to summarize: your file structure will look something like this: myclientapp/ `--> templates/ `------> __init__.py `------> person.html Hope this helps!
@arunpandian2887
@arunpandian2887 3 года назад
Hi Tom, Thanks Tom for this tutorial, While launching my application using below hosts after creating schema , my server is up but the page is not loading. t1.postgres.local:8000 t2.postgres.local:8000 Could you please help me to resolve this?
@dan_isaza_dev
@dan_isaza_dev 3 года назад
You may need to edit the `/etc/hosts` file on your computer so that `t1.postgres.local` and `t2.postgres.local` are redirected to localhost. (Also note that when editing the `/etc/hosts` file, you may need to do so with `sudo`, as it may be protected.) For example, here's what my `/etc/hosts` looks like. I followed Tom's tutorial and set up the domain for t1 and t2 to be `t1.myapp.local` and `t2.myapp.local`. 127.0.0.1 localhost 127.0.0.1 t1.myapp.local 127.0.0.1 t2.myapp.local I hope this helps!
@supersayan6318
@supersayan6318 4 года назад
Good tutorial, but this doesn't explain that you need to download Postgresql separately when switching from sqlite3.
@AjibolaLDonjibson
@AjibolaLDonjibson 4 года назад
Can my tenant use their custom domain xyz.com instead of my own subdomain like tenant.mydomain.com
@JoshDavies89
@JoshDavies89 4 года назад
Did you manage to sort?
@AjibolaLDonjibson
@AjibolaLDonjibson 4 года назад
Yes I did ... Do you need help of any sort?
@JoshDavies89
@JoshDavies89 4 года назад
@@AjibolaLDonjibson Yes, was wondering how you managed to do it! :D Something i'm looking at doing myself as i'm building an web app with django-tenants :) Thanks for getting back me!
@AjibolaLDonjibson
@AjibolaLDonjibson 4 года назад
@@JoshDavies89 kindly contact me privately. i will explain in details
@JoshDavies89
@JoshDavies89 4 года назад
@@AjibolaLDonjibson i've dropped a comment on your YT page. Howeever, not sure the best to contact you?
@nabeelahmed2574
@nabeelahmed2574 4 года назад
Please give me ans I am still waiting for your response
@thomasturner2279
@thomasturner2279 4 года назад
I already have :)
@nabeelahmed2574
@nabeelahmed2574 4 года назад
Can you share your code for multiple domains for one schema?
@thomasturner2279
@thomasturner2279 4 года назад
@@nabeelahmed2574 There is no code Just add the extra domain in the domain table under Django admin
@nabeelahmed2574
@nabeelahmed2574 4 года назад
@@thomasturner2279 ok sir I will try thanks for replyi😊😊
@nabeelahmed2574
@nabeelahmed2574 4 года назад
@@thomasturner2279sir Do not understand how it will be, please can you help me?
Далее
How to get Django Tenants up and running
27:12
Просмотров 20 тыс.
How to use views and ULS in Django Tenants
14:38
Просмотров 3,6 тыс.
Дежавю, прескевю и жамевю!
00:59
Просмотров 284 тыс.
Мужа или парня
00:42
Просмотров 15 тыс.
Multitenant applications: how and why
24:54
Просмотров 9 тыс.
Python Django Inheritance Optimisation Exercise
52:56
Arquitectura Multitenant en Django
24:21
Просмотров 6 тыс.
Custom Analytics // Django Tutorial // Data Collection
57:54
Дежавю, прескевю и жамевю!
00:59
Просмотров 284 тыс.