Dockerizing a Django REST Framework Project

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

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

  • @brianr3925
    @brianr3925 5 ปีที่แล้ว +6

    For those with issue: SyntaxError: Generator expression must be parenthesized.
    The issue is because of a recent patch to Django 1.11
    I fixed it by changing the requirements.txt file.
    Replace Django==1.11 to Django==1.11.17
    Then in your terminal run:
    docker-compose build
    Then rerun the command
    docker-compose run web python src/profiles_project/manage.py migrate

    • @adeoke3086
      @adeoke3086 4 ปีที่แล้ว

      That worked thanks.

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

    Amazing. You took less than 20 minutes to show us, explained every line and what they mean, and the best part; it worked!
    The only thing I had to change was the pathing for running manage.py, I didn't need the folders to run the scripts. Thanks!

  • @HotIronMusic
    @HotIronMusic 6 ปีที่แล้ว +13

    Thank you! Can you make a tutorial for production using nginx-gunicorn-postgresql?

    • @shahabazboss2
      @shahabazboss2 5 ปีที่แล้ว

      Does this help? th-cam.com/video/3cRT1RmCyKg/w-d-xo.html

  • @richcodesweb
    @richcodesweb 9 หลายเดือนก่อน

    would be really useful if either the Dockerfile or the docker-compose file could get the git repository ... how would you make one of them do that?

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

    it works..! thanks bro, it's so useful for me

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

    Hello! great video, helped me a lot! but I have a doubt when there is a syntax error the docker container crashes and I have to raise it again by hand. Any ideas to correct this?

  • @TanjimAshraf-nr2hh
    @TanjimAshraf-nr2hh ปีที่แล้ว

    Thanks for such a good explanation

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

    This still applies to 2021. Thank you a lot!

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

    Thanks man! It is a super useful and well explained video! Thanks a lot!

  • @rlxinc.6016
    @rlxinc.6016 2 ปีที่แล้ว

    Thank you so much.

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

    How do you deal with creating a superuser for django admin login

    • @LondonAppDeveloper
      @LondonAppDeveloper  6 ปีที่แล้ว

      Good question, you can run `docker-compose run web python src/profiles_project/manage.py createsuperuser` for that I believe.

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

    Thank you

  • @56BAK
    @56BAK 3 ปีที่แล้ว

    Thanks

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

    thank you first of all for this very understandable tutorial, i just wana know how can a distant front end developper use my docker container, to test his requests ??

  • @marcobelo4795
    @marcobelo4795 6 ปีที่แล้ว

    It's worked! Thank you, i'm starting with docker and loving it!

  • @LepsMere
    @LepsMere 6 ปีที่แล้ว

    Thanks a lot London App Developer. Easy and simple explanations.Nicely done.

  • @juancarloselorriaga6171
    @juancarloselorriaga6171 4 ปีที่แล้ว

    Awesome tutorials, it would be great if you could teach us how to deploy one of your projects with best practices of data storing and cloud configurations. I took the TDD course and got stuck on deploying the project to the cloud. Thanks!

    • @LondonAppDeveloper
      @LondonAppDeveloper  4 ปีที่แล้ว

      Funny you should ask. We have a new deployment course out today. Check out our latest video to learn more. Thanks for the support!

  • @Amanda-qu9uw
    @Amanda-qu9uw 2 ปีที่แล้ว

    Hi, I am very new to Docker. I just had a quick question, can production applications be successful with docker compose for windows? Or will I need to use docker compose for windows server?

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

    Thank you for making this!

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

    I need a help on creating a dockerize django project in which i can easily alter the internal files of django and it should be reflected to the live container without restarting it.

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

      This is done using a volume mapping in docker-compose.

  • @tinsjohny
    @tinsjohny 6 ปีที่แล้ว

    Great video.... Thanks a lot buddy... how to connect this docker file with Apache and mod-wsgi?

  • @jamilsmith8981
    @jamilsmith8981 6 ปีที่แล้ว

    Nice tutorial. How do I stop (CTRL C) and then start the server again?

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

    what web server would you recommend for production? how would I set it up with docker?

    • @DeViLTh0rn
      @DeViLTh0rn 4 ปีที่แล้ว

      Michael Stewart heroku?

  • @theEVcouple
    @theEVcouple 6 ปีที่แล้ว

    I've been asked to start docker machine. I can't create one docker-machine because "Error with pre-create check: "This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory"
    "

    • @OusamaEsbel
      @OusamaEsbel 6 ปีที่แล้ว

      this answer should solve your problem (even tho it is not docker related) stackoverflow.com/questions/21757368/unable-to-start-genymotion-virtual-device-incompatible-cpu/21757529#21757529

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

    Django 1.11 won't run with Python 3.7, gives a Syntax Error. Solved this by changing the Dockerfile's first line:
    FROM python:3.6-alpine

    • @susajsn3314
      @susajsn3314 6 ปีที่แล้ว

      I am still facing this issue. Are there any steps to follow after changing this in Dockerfile?

    • @AlessandroBottoni
      @AlessandroBottoni 5 ปีที่แล้ว

      It is working on my machine with this Dockerfile first line:
      FROM python:2.7
      Linux Mint 18.3 "Sylvia" (based on Ubuntu Xenial), docker version 17.03.2-ce, docker-compose version 1.22.0, requirements.txt, dockerfile and docker-compose.yml as in the tutorial.

    • @grantzhang6041
      @grantzhang6041 5 ปีที่แล้ว

      Do you know how to install Matplotlib in requirements.txt?

  • @sreekanthreddy8460
    @sreekanthreddy8460 6 ปีที่แล้ว

    Hi Can you do video create docker image for running python django with nginx and gunicorn

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

    when I run the migrate command, I am getting the below error
    SyntaxError: Generator expression must be parenthesized
    can any one please help me, how to solve this error

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

      Sounds like you missed some syntax... Could be a simple typo. I suggest double checking your code against the code created in the video.

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

      @@LondonAppDeveloper Thank you very much for your reply

  • @rhasangvvf
    @rhasangvvf 6 ปีที่แล้ว +2

    First, thanks for the awesome video. Can you make a short video on how to dockerize an existing django app with postgresql? I'm facing a lot of problem. it's showing:
    django.db.utils.OperationalError: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
    could not connect to server: Cannot assign requested address
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
    No idea what to do.... :-(

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

      do you solve that error? :(

  • @squadran20031
    @squadran20031 6 ปีที่แล้ว

    As Daniele says, please could you do a tutorial for deploying nginx-gunicorn-postgres image, I have tried everything but can't get the container to run on the server.

    • @shahabazboss2
      @shahabazboss2 5 ปีที่แล้ว

      Does this help? th-cam.com/video/3cRT1RmCyKg/w-d-xo.html

  • @Harris237
    @Harris237 6 ปีที่แล้ว

    When I am trying to execute the docker-compose up command or migrate command, i am getting permission denied error
    (null): can't open file 'src/profiles_project/manage.py': [Errno 13] Permission denied
    Any help please.

    • @Harris237
      @Harris237 6 ปีที่แล้ว

      fixed it, it was because on my linux environment selinux was enabled.

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

    Database will be created each time you starts docker

  • @samnik12345
    @samnik12345 5 ปีที่แล้ว

    Can I delete my vagrant file and Vagrant folder after I add Docker

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

    very nice video thanx

  • @JonesDTaylor
    @JonesDTaylor 7 ปีที่แล้ว

    Thanks. I followed your REST tutorial. It was fantastic. Here you used port 8000 instead of 8080, any reason for this small change ?

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

      Thanks Younes! Appreciate you taking the REST tutorial and glad you found it useful. No particular reason for the change in port, it may have been because I was running the Vagrant version of this project in port 8080 and I wanted to avoid a clash.

    • @JonesDTaylor
      @JonesDTaylor 7 ปีที่แล้ว

      Thanks for the quick reply. Any new Udemy courses coming soon ? I am trying to learn how to combine Django Rest Framework with React Native to build mobile applications.

  • @andyh2164
    @andyh2164 7 ปีที่แล้ว

    Nice guide! What command would I put in my compose to make migrations and apply them, or would this be done manually, typically?

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

      Hey Andy, you would run "docker-compose run web python src/profiles_project/manage.py migrate"

    • @anishkumarb3135
      @anishkumarb3135 5 ปีที่แล้ว

      If you make some changes to the existing model (add a new column, which is a required field) and perform "migrate" command it will ask you to enter a value for the existing rows... How could you automatic this in the case of continuous deployment..

  • @dexelopdexelop6079
    @dexelopdexelop6079 6 ปีที่แล้ว

    awsome video. Thank you. One thing that I want you to upgrade ur mic for more clear voice

    • @LondonAppDeveloper
      @LondonAppDeveloper  6 ปีที่แล้ว

      Thanks for watching and for the feedback. We do have a professional Mic so we'll look at how we can tweak the setitngs to make it clearer.

  • @rishabhdevgupta5378
    @rishabhdevgupta5378 4 ปีที่แล้ว

    Hey, I am from india. it is cool dude, can you tell me how we can make microservices?

  • @timhale2704
    @timhale2704 6 ปีที่แล้ว

    Hi, I'm trying this to get Docker setup for your corresponding udemy course, but I'm getting the following error at the end when I try to run it (I also get the same error when I first ran your migration command). I've cloned your git repo and believe I did everything the same as you did in this clip, but I'm not sure if I've made a mistake somewhere, so if you have any ideas please let me know?
    $ docker-compose up
    Starting byobprofilesrestapi_web_1 ...
    Starting byobprofilesrestapi_web_1 ... done
    Attaching to byobprofilesrestapi_web_1
    web_1 | python: can't open file 'src/profiles_project/manage.py': [Errno 2] No such file or directory
    byobprofilesrestapi_web_1 exited with code 2

    • @LondonAppDeveloper
      @LondonAppDeveloper  6 ปีที่แล้ว

      Hi Tim, It looks like the source files are not being copied to the docker image when running `docker build`. Would you kindly share your code with me via GitHub and I can take a look at why this might be?

  • @TheInkedEngineer
    @TheInkedEngineer 6 ปีที่แล้ว

    Great tutorial, saved my ass! Got a question and I don't know how much it makes sense.. when you create a docker image, how can you copy it? Like let's say I was to pass it to someone via email, is it possible?

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

      Hey mate, glad you found it useful! Basically you would either share the `Dockerfile` or you can publish the image to a registry such as hub.docker.com/ using `docker push`. Then they should be able to pull it down using the registry URL.

    • @TheInkedEngineer
      @TheInkedEngineer 6 ปีที่แล้ว

      thank you for your response. One last question, if I need to mount a config file to that image, is it possible? what should I be looking for? Again, great job. I'll make sure to subscribe.

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

    Need to work on your audio.. Can barely hear you.

  • @susajsn3314
    @susajsn3314 6 ปีที่แล้ว

    Dude, "SyntaxError: Generator expression must be parenthesized" this is what i am getting

    • @brianr3925
      @brianr3925 5 ปีที่แล้ว

      I fixed it by changing the requirements.txt file.
      Replace Django==1.11 to Django==1.11.17
      Then in your terminal run:
      docker-compose build
      Then rerun the command
      docker-compose run web python src/profiles_project/manage.py migrate

  • @brunocarozza5623
    @brunocarozza5623 5 ปีที่แล้ว

    Superb content, bad audio :\