Django Multiple Database Setup Ex1

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024

ความคิดเห็น • 124

  • @PythonicPath1
    @PythonicPath1 3 ปีที่แล้ว +8

    any Django developer that doesn't know this channel is missing something , Thanks for this amazing videos !!

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Thanks Azzam 👍

    • @KodingTreecom
      @KodingTreecom 3 ปีที่แล้ว +2

      I just subscribed after reading this comment.

    • @uweopfern
      @uweopfern 2 ปีที่แล้ว +1

      Totally agree, this guy is an amazing django developer that I have ever seen

    • @felicytatomaszewska
      @felicytatomaszewska ปีที่แล้ว

      What this channel is missing?

  • @aaklii
    @aaklii 3 ปีที่แล้ว +21

    I am totally blown by the new variety of contents you are coming up with.
    I am thankful to you for efforts u are taking to make developers like me much skillful.

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +4

      It's my pleasure 👍

  • @robertfilson1917
    @robertfilson1917 3 ปีที่แล้ว +1

    I have been struggling with creating multiple databases and importing legacy databases that are read-only. This tutorial really helped me understand how routers work. Thank you very much for that. I will point anybody else who is struggling with it to this video.

  • @uweopfern
    @uweopfern 2 ปีที่แล้ว +1

    The best django developer on the planet, damn amazing

  • @andrewsmichael7047
    @andrewsmichael7047 3 ปีที่แล้ว

    This tutorial deserves an applause
    It have serve my time from MongoDB errors and with postresql relationship in the Django admin
    Thank you sir.

  • @gbrachetta
    @gbrachetta 3 ปีที่แล้ว +3

    Great!!. I wasn't aware of this until now. Congratulations for such an specialised channel. Definitely the one to go for Django-related content!

  • @vijaypandey9761
    @vijaypandey9761 3 ปีที่แล้ว +3

    Easy to understand and easy to implement. Thank you for the tutorial.

  • @omarsarmientorolo4065
    @omarsarmientorolo4065 ปีที่แล้ว +1

    Thanks for video... great job! Special for multi tenant architecture

  • @omarsarmientorolo4065
    @omarsarmientorolo4065 ปีที่แล้ว +1

    Thanks for video... great job! Special for multi tenant architecture

  • @SrimalSamarasooriya
    @SrimalSamarasooriya 2 ปีที่แล้ว

    Man... Thank you for this... Keep sharing your Django wisdom...

  • @rahulsaha2859
    @rahulsaha2859 3 ปีที่แล้ว +2

    yesterday faced an interview where they asked how you configure different db in django and here I am learnt how, now gonna crack the next. Thanks sir... also I am facing below issue ...
    ''ConnectionDoesNotExist at /admin/blue/blue/''

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Hi Rahul, well the very best of luck to you, I am sure you will get that job soon enough. Regarding the error, it is one of those it could be a few things, an incorrect name/typo or migrations out of sync or database config issues.

  • @KrishnaManohar8021
    @KrishnaManohar8021 3 ปีที่แล้ว +1

    Thank you for considering my feedback. and waiting for the next video...

  • @EmileNani
    @EmileNani 2 ปีที่แล้ว

    This was very helpful, thank you. I wanted to use Django as an admin micro-service which this has helped me to do.

  • @Tauseef
    @Tauseef 3 ปีที่แล้ว

    Just to let you know you are doing a great job! Subscribed!!

  • @abraaobb
    @abraaobb ปีที่แล้ว

    Thank you so much for tutorial.

  • @backendmystery
    @backendmystery ปีที่แล้ว

    Thanks, needed the explanations

  • @blackcoder9532
    @blackcoder9532 3 ปีที่แล้ว

    This video is very helpful to me thankyou for making this video😭

  • @mrHuangEnglish
    @mrHuangEnglish 3 ปีที่แล้ว +1

    Wow! Wonderful material. Thank you so much!

  • @mesakenavunawa8912
    @mesakenavunawa8912 2 ปีที่แล้ว +1

    Amazing content.

  • @mail4upendra
    @mail4upendra 3 ปีที่แล้ว +1

    Great Tuorial! Keep it up! Thank you 3000 :D

  • @alperakbash
    @alperakbash 2 ปีที่แล้ว

    Thank you so much for such a perfect tutorial. Is there any chance for a next video on testing with multiple databases?

  • @oauth9728
    @oauth9728 3 ปีที่แล้ว +1

    Not viewing , but I trust the content!

  • @divitrao4296
    @divitrao4296 3 ปีที่แล้ว

    You bring really good content. Thank you

  • @yasayah7289
    @yasayah7289 2 ปีที่แล้ว

    Great content! Slightly different topic, but will you be providing a tutorial on RBAC or have you already?

  • @atharvamishra4848
    @atharvamishra4848 3 ปีที่แล้ว +1

    settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
    even after adding 'session' and 'admin'

    • @킥갓
      @킥갓 3 ปีที่แล้ว

      I have same problem. Did u fix it? :(

  • @PankajSavaliyaGoogle
    @PankajSavaliyaGoogle 3 ปีที่แล้ว +1

    Very impressive, can you please release the next episode with foreign key, prefetch_releated, select_related and etc? Thanks, man!

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +2

      I was just a few hours ago thinking about how to extend this further - thank you.

    • @PankajSavaliyaGoogle
      @PankajSavaliyaGoogle 3 ปีที่แล้ว +1

      @@veryacademy 😂😂😂 see we're on same track.

  • @harryabc1789
    @harryabc1789 3 ปีที่แล้ว +1

    Can you please make a tutorial about how to provide relationship between multiple database ?

  • @MrAntivirus66
    @MrAntivirus66 3 ปีที่แล้ว +1

    Hey good sir, first of all i want to thank you for all effort you are putting in :). i am making face recognition + django web app, so i am interested how to connect them, i am beginner, but i hope so i ll figure it out .

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +1

      You are the second person today regarding face recognition... I will get back into ML sooner than later! Thank you - good luck!

  • @mehranj73
    @mehranj73 3 ปีที่แล้ว +2

    Would you please make a video about atomic transactions?

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +1

      Hi Mehran, I will add to the suggestions. Thank you

    • @KrishnaManohar8021
      @KrishnaManohar8021 3 ปีที่แล้ว

      What it means exactly atomic transactions???

  • @djangodeveloper07
    @djangodeveloper07 2 ปีที่แล้ว

    great video. any more video on this topic ?

  • @natarajanm4036
    @natarajanm4036 3 ปีที่แล้ว +1

    Could you please cover the High availability scenario . Lets say My DB's are hosted in two different Data Centre's . If one of the DB Server is failed the app should run with other DB Server in different DC. And if the failed DB has recovered it should sync with other DB .As soon as it came up.

  • @gabycarrizal9395
    @gabycarrizal9395 2 ปีที่แล้ว +1

    maybe a dumb question, is mandatory to create multiple applications in order to use multiple connections? or is more like a good practice? sorry I'm new

    • @veryacademy
      @veryacademy  2 ปีที่แล้ว +1

      Never a dumb question. There is no mandatory. If I think I understand, make as many apps as you need. Ideally at least to start with stick with 1 database

  • @fowad27
    @fowad27 2 ปีที่แล้ว

    Great video, but what's the purpose of having multiple databases rather than tables within one database?

  • @gulzarsingh716
    @gulzarsingh716 2 ปีที่แล้ว

    How to connect multiple legacy databases with tables in the same app? How to do migrations?

  • @dexterfortsilva6656
    @dexterfortsilva6656 ปีที่แล้ว

    can you make a new tutorial of this with relations like a user on the first db and bank on the other db and user can add a bank acc based on the second db

  • @mosco225
    @mosco225 ปีที่แล้ว +1

    Hello ❤ has you make a second part ?

  • @LocoARG
    @LocoARG 3 ปีที่แล้ว +1

    Thank You!!!!

  • @jaguarnet
    @jaguarnet 3 ปีที่แล้ว +1

    this is unique awesome content, such option drive everyone to think to use django for microservices, if we can split the project in multiple DBs, can we do the same and deploy the Application to multiple servers? if yes this will accomplish the theory of microservice , can we ?

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Hi Fahd, yes Django as the framework within microservices setup/architecture - we can do that. As per normal with any suggestion like this we would find 100 people for and and 100 people against doing so. Some would say this would be counter productive, unnecessarily or complicated. There would be some who would suggest with Django sticking with monolithic and deploy to multiple instances with for example a load balancer and hardware tuning. Who needs to learn microservices when we have serverless 😁👍

    • @jaguarnet
      @jaguarnet 3 ปีที่แล้ว

      @@veryacademy May you explain in little details what benefits I will get of being paid member of your channel as I can see all your videos are available along with resources

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +1

      @@jaguarnet Hi Fahd, research has revealed that spending money on others actually makes us happier than spending it on ourselves, and giving to others can actually make us healthier! There are no other tangible benefits for you or me subscribing to the members community. I will continue to produce free content. If google should provide more views or if I can gain a larger number of members, the associated financial rewards will enable me to increase the amount, quality and depth of tutorials on this platform. This is a not-for-profit service, all other monies gained will find its way back into producing more content and helping others to access education. I hope that you continue enjoying the content - thank you for your comments 👍

    • @jaguarnet
      @jaguarnet 3 ปีที่แล้ว +1

      @@veryacademy This is awesome from you wishing you very good luck I promise I will subscribe in case if I demanded on your excellent material more and if I were I would slightly change my strategy little and I will share more advanced topics to the paid subscribers and free medium level for the free subscribers whiching you very good luck at anyway :)

  • @rangarajann1781
    @rangarajann1781 2 ปีที่แล้ว

    How to use different schemas in a single database in django?

  • @tamirtsogbayar3912
    @tamirtsogbayar3912 2 ปีที่แล้ว

    Hello thanks for this tutorial
    Pls help me i use mongodb as second db then i stuck how to write router for mongodb

  • @jairajsahgal7101
    @jairajsahgal7101 2 ปีที่แล้ว +1

    Is there a way to manually select models for saving into different databases?

    • @veryacademy
      @veryacademy  2 ปีที่แล้ว

      Hey, models in django refers to tables. Are you asking me how to define which model should be saved in which database?

    • @jairajsahgal7101
      @jairajsahgal7101 2 ปีที่แล้ว

      @@veryacademy Yes, sorry for poor english. I tried routers method but it would create all the tables inside my default database.

  • @narmindm
    @narmindm 2 ปีที่แล้ว +1

    Hi, a very cool lesson!1 Thank you! Can you tell me, please, the django_migrations file is created in all databases, and it is the same, is it possible to avoid this behavior?7 For example, I have an additional step to change the table, but I don't have access to create a new table, what should I do?

    • @veryacademy
      @veryacademy  2 ปีที่แล้ว +1

      Migrate first and change the migration file before makemigrations

    • @narmindm
      @narmindm 2 ปีที่แล้ว

      Thanks!! I will try to do this

  • @developers_hub
    @developers_hub 2 ปีที่แล้ว

    How can we define relationship between tables in different databases ? Django has no built in support for that, But says can fake the cross connection. How can we achieve this ?

  • @sunagshetty9279
    @sunagshetty9279 3 ปีที่แล้ว

    Thanks for this valuable information, i have one requirement, in a existing project with default data base configuration, please note data base has many tables, what i have to do to create a new data base for future applications we create in that project. in a nutshell i want a extra data base configuration without altering default case, as data base is filled with many data, please help here.

  • @VijayKumar-dq3ph
    @VijayKumar-dq3ph 2 ปีที่แล้ว

    Nice vedio! could you please tell how to implement cross database relationships? Any hints?

  • @3DGFan9000
    @3DGFan9000 2 ปีที่แล้ว

    not sure whats going on with mine. I have an AuthRouter, and one called DeliveryRouter. When i migrate database=deliveries_db it brings in all of the auth tables as well, and the other way when i migrate users_db. If I do standard migrate it puts tables from my delivery app on the default database. Looks identical to what you demoed.

  • @murishou
    @murishou 3 ปีที่แล้ว

    Awesome!

  • @HDKHKhmer
    @HDKHKhmer 2 ปีที่แล้ว

    I have User.db in Mysql(database 1) and Product.db in postgres (database 2 ) . How to connecting both database and relationship ?

  • @YadavAjay-f6u
    @YadavAjay-f6u 6 หลายเดือนก่อน

    too good

  • @smitpanchal9866
    @smitpanchal9866 ปีที่แล้ว

    How can I set FK for multiple database?

  • @LouisAgyapong
    @LouisAgyapong 3 ปีที่แล้ว

    Great content.

  • @jorisjansen2892
    @jorisjansen2892 3 ปีที่แล้ว +1

    Great tutorial! How would you create relations between models in different databases? Or would you store a reference on a model such as a user_id field, which the user would send with the JWT token, to look for user-specific objects? Cheers

    • @ganeshniranjan895
      @ganeshniranjan895 2 ปีที่แล้ว

      I am looking for the same ... have you found any solution regarding this

    • @jorisjansen2892
      @jorisjansen2892 2 ปีที่แล้ว

      @@ganeshniranjan895 You should store a reference. It's impossible to have relations between different databases. So storing a user_id or user_uuid would be preferred. Good luck!

    • @ganeshniranjan895
      @ganeshniranjan895 2 ปีที่แล้ว

      @@jorisjansen2892 Thank you brother & one last thing i'm using Postgres, so, is it okay if i create the view of user in another db ... will it work ... any suggestions

    • @jorisjansen2892
      @jorisjansen2892 2 ปีที่แล้ว

      @@ganeshniranjan895 not sure what you mean with ‘view of user’. Could you please elaborate?

    • @ganeshniranjan895
      @ganeshniranjan895 2 ปีที่แล้ว

      @@jorisjansen2892 It is kind of a pseudo-table, these are not real tables take it has a copy of the auth_user table in this case

  • @NeraJima
    @NeraJima 3 ปีที่แล้ว +1

    When creating a custom user model, we must do user.save(using=self._db). Would we do user.save(using=self.users_db) if our custom database's name is users like the case in this video?

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +1

      Don't need self just the _db

  • @noblessetech
    @noblessetech 2 ปีที่แล้ว +1

    Django doesn't support relation between different databases so what's the point of using this?

    • @veryacademy
      @veryacademy  2 ปีที่แล้ว +1

      When you have more than one database that doesn't depend on relational support

  • @vaibhavlodha1560
    @vaibhavlodha1560 3 ปีที่แล้ว +1

    How will be manage test cases which uses particular db?

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Great question.
      docs.djangoproject.com/en/3.2/topics/testing/tools/#multi-database-support
      look for Multi-database support

  • @Julian-uy9jh
    @Julian-uy9jh 3 ปีที่แล้ว

    my admin add new object, and clicking on specific object do not work in admin GUI. Deleting an object works though. It says settings.DATABASES is improperly configured. Does anyone know why?

  • @stringconsultants2645
    @stringconsultants2645 3 ปีที่แล้ว

    I connected multiple database using multiple djangoApplication but Join is not working ,One particular application model class
    i try to use same application but another class model getting error (1146, "Table 'coinvest.tbl_positiontest' doesn't exist").
    its connect another database i need support any one help me ....

  • @Jakub1989YTb
    @Jakub1989YTb 3 ปีที่แล้ว

    Can you have foreign keys between the modles living in different databases?

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Hi Jakub, if you are referring to FK to FK relationships
      stackoverflow.com/questions/29528323/can-a-foreign-key-reference-another-foreign-key/29571740

  • @aakashmania
    @aakashmania ปีที่แล้ว

    I am getting module router not found error , can anyone help me !

  • @hosseintaheri9019
    @hosseintaheri9019 3 ปีที่แล้ว +1

    thanks sir , is it possible to make relations between tables from different databases ? imagine having two dbs : shop_db and auth_db ,
    I created an app called accounts and defined my custom User that inherits from AbstractUser then I migrated it into auth_db ,
    then I created an app called orders and defined an Order model in it , it has a ForeinKey relation to my custom User model , then I migrated Order into shop_db ,
    but when I try to assign a user to an order in admin I get this error : no such table: main.accounts_user

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว +2

      Hmm that would be a good tutorial 👍

    • @hosseintaheri9019
      @hosseintaheri9019 3 ปีที่แล้ว

      @@veryacademy 🙏🙏❤️❤️

    • @jorisjansen2892
      @jorisjansen2892 3 ปีที่แล้ว

      @@veryacademy This was my question as well, would be awesome if you could create a video about this!!

  • @natarajanm4036
    @natarajanm4036 3 ปีที่แล้ว +1

    100th Like

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      That is like amazing 👍

  • @wobblyjellyman69
    @wobblyjellyman69 3 ปีที่แล้ว

    router? I hardly know 'er!

  • @felicytatomaszewska
    @felicytatomaszewska ปีที่แล้ว +1

    The word is ROUTER not ROOTAR 😂😂 It is so funny

  • @kevinzettel
    @kevinzettel 2 ปีที่แล้ว +1

    the biggest Issue is the admin isn't hooked up to the two remote databases and using the remote databases table it's using it's local table. as such I think this is pointless which you just did and I'm pretty sure after researching for hours that Django can't support the admin table with multiple databases. either don't use the admin table or don't use multiple databases.

    • @veryacademy
      @veryacademy  2 ปีที่แล้ว

      Can I just confirm. You would like to see 2 databases used on one admin site. Is that correct.

    • @kevinzettel
      @kevinzettel 2 ปีที่แล้ว

      ​@@veryacademy No I found out that you just have to use the "default". one admin DB and one app db and the admin db must be use the default database. something that took me forever to figure out was the admin.model to connect them. figured it out like 3 hours ago and it's actually really nice with optional admin configurations.

  • @olb47
    @olb47 3 ปีที่แล้ว

    ModuleNotFoundError: No module names 'routers' - what could be the cause?

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Are you following this tutorial only or adding to an existing project

    • @olb47
      @olb47 3 ปีที่แล้ว

      @@veryacademy adding to the existing project

    • @aakashmania
      @aakashmania ปีที่แล้ว

      Same error , did your error got solved ?

    • @SofiaParker777
      @SofiaParker777 ปีที่แล้ว

      ​@aakashmania3784 did you find the solution ?

  • @AcademyOmen
    @AcademyOmen 3 ปีที่แล้ว +1

    💃💃💃💃Router