How to connect Django to MySQL in a Docker Container

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ก.พ. 2025

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

  • @llamalogiclab
    @llamalogiclab 2 หลายเดือนก่อน

    Thanks bro, this video helps me a lot.

  • @true_indian987
    @true_indian987 7 หลายเดือนก่อน

    Nice and simple bro ..thank you!

  • @matitronix1000
    @matitronix1000 9 หลายเดือนก่อน +2

    qlo, me hiciste toda la pega, te amo

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

    thank you, this was very helpful

  • @pythonweb-yx2vu
    @pythonweb-yx2vu 8 หลายเดือนก่อน

    very good work!

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

    Hii, I am new to docker i am just trying to connect my local database with the django docker file i don't have docker compose and i just want to do it without compose file for experiment purpose. can you please just guide me how i can i do this and even this is possible or not. please guide me i will thankfull for reply. Thanks.

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

      Assuming you are running your database locally, it would most likely be exposing an open endpoint to a specific port on localhost. In your Django project, you need to specify the settings for the given database to create a connection. If you can run the Django setup locally, it would work the same in a container. In this video, I just show that a connection was made and that we can migrate the expected database setup from Django to our database. In a real use case where you want to connect to the database while running your Django app, it takes a bit more setup. We would create some models which would match some tables. These models in Python can then be used to get and save data.

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

    I am facing issue like all admin related tables able to load MySQL but inside application tables unable to load

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

      This issue could be due to various reasons:
      1. Incorrect database settings in Django's settings.py
      2. Issues with database connection
      3. Permission issues with the MySQL user specified in settings.py
      4. Incorrect mapping of the tables in Django's models.py
      Try checking your Django settings.py to ensure the database connection is setup correctly. Also, check the user specified has the necessary permissions to access the database. Finally, check the models.py file to make sure the tables are correctly mapped to the database.

  • @MilahnMartin
    @MilahnMartin 5 หลายเดือนก่อน

    Thanks for not showing the Dockerfile

    • @Randomcode_0
      @Randomcode_0  5 หลายเดือนก่อน

      The Dockerfile can be seen at 1:01, and the docker-compose file can be seen at 1:36.