Тёмный

Dockerizing a Django REST Framework Project 

London App Developer
Подписаться 20 тыс.
Просмотров 53 тыс.
50% 1

In this video, I’ll show you how to create a Docker container for a Django REST Framework project. As a follow up to this video you might want to check out How to set up PostgreSQL database with a Django Docker application: • Setting up PostgreSQL ...
Docker: www.docker.com
Docker-Compose: docs.docker.com/compose/install/
byob-profiles-rest-api
COURSES
• Build a Backend REST API with Python & Django BEGINNER: www.udemy.com/course/django-p...
• Build a Backend REST API with Python & Django, Django REST Framework and Docker using Test Driven Development (TDD) ADVANCED: www.udemy.com/course/django-p...
• DevOps Deployment Automation with Terraform, AWS and Docker: londonappdeveloper.thinkific....
OTHER VIDEOS YOU MIGHT LIKE:
○ Prepare a Django app for Deployment using Docker - • Prepare a Django app f...
○ BUILD A BACKEND REST API with Python, Django REST Framework, Django, Vagrant & VirtualBox - • Build a BEGINNER backe...
○ BUILD A BACKEND REST API with Python, Django & Test Driven Development - • Build an ADVANCED back...
○ CREATING A DJANGO PROJECT with Docker - • CREATING A DJANGO PROJ...
○ Setting up PostgreSQL database with a Django Docker application - • Setting up PostgreSQL ...
○ THE 4 BEST WAYS TO DEPLOY A DJANGO APPLICATION - • The 4 best ways to dep...

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

 

21 июл 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 72   
@rednaxelA1122
@rednaxelA1122 Год назад
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!
@marcobelo4795
@marcobelo4795 5 лет назад
It's worked! Thank you, i'm starting with docker and loving it!
@matiaszulberti9996
@matiaszulberti9996 2 года назад
Thanks man! It is a super useful and well explained video! Thanks a lot!
@LepsMere
@LepsMere 6 лет назад
Thanks a lot London App Developer. Easy and simple explanations.Nicely done.
@Googletrash9383
@Googletrash9383 5 лет назад
Thank you for making this!
@redington3703
@redington3703 5 лет назад
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 ??
@haidinurhadinata2661
@haidinurhadinata2661 2 года назад
it works..! thanks bro, it's so useful for me
@UndeadSasuke34
@UndeadSasuke34 2 года назад
This still applies to 2021. Thank you a lot!
@brianr3925
@brianr3925 5 лет назад
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.
@jamilsmith8981
@jamilsmith8981 6 лет назад
Nice tutorial. How do I stop (CTRL C) and then start the server again?
@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!
@tinsjohny
@tinsjohny 6 лет назад
Great video.... Thanks a lot buddy... how to connect this docker file with Apache and mod-wsgi?
@TanjimAshraf-nr2hh
@TanjimAshraf-nr2hh 11 месяцев назад
Thanks for such a good explanation
@LondonAppDeveloper
@LondonAppDeveloper 9 месяцев назад
Thank you for watching!
@carlosguzman761
@carlosguzman761 2 года назад
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?
@HotIronMusic
@HotIronMusic 6 лет назад
Thank you! Can you make a tutorial for production using nginx-gunicorn-postgresql?
@shahabazboss2
@shahabazboss2 5 лет назад
Does this help? ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-3cRT1RmCyKg.html
@sreekanthreddy8460
@sreekanthreddy8460 6 лет назад
Hi Can you do video create docker image for running python django with nginx and gunicorn
@rlxinc.6016
@rlxinc.6016 2 года назад
Thank you so much.
@edtur6063
@edtur6063 6 лет назад
very nice video thanx
@caetanog_
@caetanog_ 3 года назад
Thank you
@samnik12345
@samnik12345 5 лет назад
Can I delete my vagrant file and Vagrant folder after I add Docker
@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? ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-3cRT1RmCyKg.html
@richcodesweb
@richcodesweb 8 месяцев назад
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?
@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?
@michaelstewart6358
@michaelstewart6358 6 лет назад
what web server would you recommend for production? how would I set it up with docker?
@DeViLTh0rn
@DeViLTh0rn 4 года назад
Michael Stewart heroku?
@56BAK
@56BAK 3 года назад
Thanks
@alectronic0
@alectronic0 6 лет назад
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.
@andyh2164
@andyh2164 6 лет назад
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 6 лет назад
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..
@JonesDTaylor
@JonesDTaylor 6 лет назад
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 6 лет назад
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 6 лет назад
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.
@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.
@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
@Harris237
@Harris237 5 лет назад
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 5 лет назад
fixed it, it was because on my linux environment selinux was enabled.
@rishabhdevgupta5378
@rishabhdevgupta5378 4 года назад
Hey, I am from india. it is cool dude, can you tell me how we can make microservices?
@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.
@rhasangvvf
@rhasangvvf 6 лет назад
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? :(
@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 лет назад
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.
@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?
@bullfalopvh
@bullfalopvh 6 лет назад
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 5 лет назад
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?
@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 года назад
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
@aryankhandelwal37
@aryankhandelwal37 3 года назад
Database will be created each time you starts docker
@susajsn3314
@susajsn3314 5 лет назад
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 4 года назад
Superb content, bad audio :\
@Blinknone
@Blinknone Год назад
Need to work on your audio.. Can barely hear you.
Далее
Prepare a Django app for Deployment using Docker
39:10
Getting Started With Django REST Framework
26:31
Просмотров 199 тыс.
skibidi toilet 76 (full episode)
08:11
Просмотров 11 млн
Django API Authentication using JWT Tokens
37:06
Просмотров 173 тыс.
Debugging a Dockerized Django app with VSCode
23:22
Просмотров 35 тыс.
Django Rest Framework | Serializers & CRUD
22:40
Просмотров 382 тыс.
Building a Django Docker Container
34:11
Просмотров 22 тыс.
I've been using Redis wrong this whole time...
20:53
Просмотров 340 тыс.