Тёмный

Prepare a Django app for Deployment using Docker 

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

How to configure a Django project to run in Docker using uWSGI for a production deployment.
Links:
- Starter project: github.com/LondonAppDeveloper...
- usgi_params file: uwsgi-docs.readthedocs.io/en/...
-Advanced course - DevOps Deployment Automation with Terraform, AWS and Docker: londonappdeveloper.thinkific....
- Finished code: github.com/LondonAppDeveloper...
00:00 - Introduction
00:54 - Open Hello World starter project
01:31 - Create a Dockerfile for the project
04:55 - Copy contents of app to the Dockerfile
06:05 - Set up new folders for static files
07:25 - Create a new user to run application
09:52 - Modify requirements.txt to add the uWSGI server
14:40 - Set up Docker-compose file to run application using Docker on local machine
17:30 - Test our application
18:42 - Create our NGINX proxy
22:10 - Create the Dockerfile for our NGINX proxy
25:12 - Test building our file
25:38 - Customise the configuration of our Django app
31:35 - Create a new Dockerfile in the root of our project
COURSES I TEACH
• 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:
○ 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 ...
○ Dockerizing a Django REST Framework Project - • Dockerizing a Django R...
○ THE 4 BEST WAYS TO DEPLOY A DJANGO APPLICATION - • The 4 best ways to dep...

Наука

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

 

8 июл 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 257   
@davidsanchezplaza
@davidsanchezplaza 10 месяцев назад
probably the best instructor. he explains everything and he knows, not just read. he doesnt make mistakes, or constantly clicking mouse to feel clever. im impressed
@LondonAppDeveloper
@LondonAppDeveloper 10 месяцев назад
aww thanks man appreciate it.
@abdullahmoiz8151
@abdullahmoiz8151 3 года назад
Terrific video I absolutely love how you've explained every single step in the dockerfile and conf files in detail
@otastrategies3271
@otastrategies3271 3 года назад
Thanks Mark. With your help I got my app dokerised. I was a bit afraid of this task but really happy that I got through it. Missing London during lockdown but keeping busy learning :-)
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks for the comment, great to hear that. Are you abroad or in the UK but not commuting to London due to lockdowns?
@akshayc4145
@akshayc4145 3 года назад
The best dev channel, giving millions of information in a very short time.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks mate, appreciate that :)
@leonardotassodossantos7077
@leonardotassodossantos7077 3 года назад
Damn Dude, just bought your course. Your explanation made my day.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you so much.
@claytonmixtape
@claytonmixtape 3 года назад
Might be the best DEV teacher I’ve ever had. From Udemy to RU-vid, thank you so much Marc
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Wow thanks man appreciate that :)
@selahmuhammad626
@selahmuhammad626 3 года назад
@@LondonAppDeveloper im sorry but for also for window users and im using postgressql server. i made website sir i just wanna upload and give a domain name please reply ..
@benjaminshtark5977
@benjaminshtark5977 Год назад
It’s just out of this world explanation!!! God Level !!
@MrAustin4399
@MrAustin4399 2 года назад
Seriously, thank you for this explanation. Very well done! Very thorough
@TheSuperFoldager
@TheSuperFoldager 3 года назад
Love how this video is recommended to me AFTER I have created my docker image... Greate video!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Brilliant!
@thedeegan
@thedeegan 3 года назад
Dude, that explanation was perfect. You deserve way more views. Thanks!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks Eric :D
@AndrewMelnychuk0seen
@AndrewMelnychuk0seen 3 года назад
Man this was so good and thorough. This is going to provide s many people with a strong foundation to build their own websites. Thanks so much!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks Andrew :)
@RJ-bk2ho
@RJ-bk2ho 4 года назад
Thanks mark !! I love the way you present your content . Learned DjangoRest from your two courses :)
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you! We appreciate you supporting our content by buying our courses, and glad you like them :)
@VeLawrence
@VeLawrence 3 года назад
My man! hats off for you! one can see with you that knowledge cannot be improvised, thanks a lot for this video!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you! :)
3 года назад
Thank you a lot, solving my concern right now !
@adila3097
@adila3097 Год назад
Respect for preparing this awesome presentation and sharing your knowledge. Thank you!
@gregchatzinicolau5698
@gregchatzinicolau5698 3 года назад
This is the best Django - Docker tutorial by far. You keep best practices and you do a very good job explaining! Thank you!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you for that :)
@theearthish
@theearthish 2 года назад
Hey! This was one of the most useful tutorials I've come across!!
@etis398
@etis398 3 года назад
Thanks a lot for this video. I am currently learning docker and this example by practice was very great for me to better understand how do we use it, on a real app.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Great to hear that... Thank you!
@kirillkruglov1418
@kirillkruglov1418 3 года назад
Absolutely great, man!
@letsgoooo361
@letsgoooo361 3 года назад
this is the best explanation I've seen on the internet so far you are the best
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks so much.
@mrmuranga
@mrmuranga 3 года назад
Well thought out and easily explained as usual by Mark....
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks so much!
@SzymonZakrzewski
@SzymonZakrzewski 3 года назад
You are doing greate job with those tutorials :) waiting for more quality content like this one
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks so much =)
@sammychafiqui1817
@sammychafiqui1817 3 года назад
thank you for this masterpiece
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
You're welcome, thanks for watching :)
@arturoolvera2604
@arturoolvera2604 3 года назад
Great tutorial, got a better understanding of what should be done when deploying django apps.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you glad it was useful!
@mmeip67
@mmeip67 3 года назад
Great tutorial, agreed you deserve more views. Thanks a lot!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks so much :)
@karishmakaris7165
@karishmakaris7165 4 года назад
Thankyou for such a detailed explanation, I am able dockerize my project...
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
You are most welcome
@jamiexue
@jamiexue 3 года назад
I love your channel. Thanks for all the videos.
@rajeshchoudhary1866
@rajeshchoudhary1866 4 года назад
That was an awesome explanation.
@LondonAppDeveloper
@LondonAppDeveloper 4 года назад
Glad you think so! Thank you!
@khmerkamsan9677
@khmerkamsan9677 3 года назад
Thank you for your great instructive video.
@Shayestehhs
@Shayestehhs 2 года назад
Simple, Fast, Usefull 👌👌
@oscargonzalez159
@oscargonzalez159 3 года назад
So I understand that the first configuration it is to test the application, and the nginx configuration it is to deploy into my server. I am a little confused because I have to put my database too in the configuration, but with your explanation, I understand very well Dockerfile and docker-compose, I was very confused about this, I just found your video, it is an excellent explanation and I say thank you very much! you saved me
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you!
@KhaosOverdrive
@KhaosOverdrive 3 года назад
Thank you so much for this!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Glad it was helpful!
@sujaysavandv6977
@sujaysavandv6977 Год назад
Thanks much!! This video helped me a lot & understood so much....
@phenvrc
@phenvrc 3 года назад
Thank you so much for this video!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
You're welcome, thanks for watching.
@fnordproducinc4258
@fnordproducinc4258 3 года назад
Thanks a lot, great tutorial!
@normansander5914
@normansander5914 3 года назад
Thanks for this awesome guidance! It helped me a lot!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Glad to hear it helped!
@tisaghchase
@tisaghchase 4 года назад
Definitely appreciate this
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you! I appreciate you taking the time to watch our content and leave a comment :) Best of luck.
@anonshubh
@anonshubh 3 года назад
Thank you , explanation was Great!!....
@Nieosoba
@Nieosoba 3 года назад
Thanks a lot! Useful and easy to follow
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks mate, appreciate that.
@JoseAlvarez-dl3hm
@JoseAlvarez-dl3hm 3 года назад
Oh man you are a life saviour, it worked wonders!, although I would have to re watch this video many times to totally grasp a little more of docker, and to study more the docker official documentation. I still find hard to grasp volumes and implementing a networking with docker.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Amazing. So glad to hear that. Volumes are basically like a shared folder... You map a volume from your host to the docker container. It's a way of adding persistent data in your Docker containers.
@radeshf
@radeshf 3 года назад
so much help, very useful tutorial
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Happy to be of service!
@michaeleggenschwiler5104
@michaeleggenschwiler5104 3 года назад
awesome explanation --> thanks!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
You're welcome, glad it was helpful and thanks for the comment :)
@rta3311
@rta3311 3 года назад
Thanks for sharing this ammmaizing course. I could understand what I understand and not. Best wishes,
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Brilliant. Thanks so much for watching!
@kaplansedat
@kaplansedat 3 года назад
Perfect explanation. But that's the point where I give up on technology stack decisions. That shouldn't be that hard to deploy a web app. Your explanation is perfect. But deployment mustn't be that hard we need guidelines and courses. Its 2021. web development going backward. its much easier 15 years ago. Don't get me wrong. It's not about you, it's not about Django. It's about web development ecosystem. We need a paradigm shift. For example if I decide to deploy on google cloud or AWS. ı should develop on production server. I should concentrate on development. with a command my development should convert to production. Only thing I worry about is database migration. keeping old date.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Yeah good point. Even with serverless technology like AWS Lambda or Google App Engine, it still takes a huge amount of work to get an app deployed successfully. Still a long way to go in terms of simplifying deployment.
@angelicking2890
@angelicking2890 Год назад
yeah I don't know why this is such a joke. I barely have experience in software development , few months, and trying to deploy my backend is being such a pain in the neck.
@sanlistonmadzima
@sanlistonmadzima 3 года назад
You know your stuff. Subscribed
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you!
@innocence3158
@innocence3158 3 года назад
thank you SO MUCH!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you for watching, glad it was useful.
@MistaWu
@MistaWu 3 года назад
Thank you sooo very much, this really helped me....
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Great to hear, thanks for watching!
@deepjyotisarma360
@deepjyotisarma360 3 года назад
thank you sir.
@MrGedKirkham
@MrGedKirkham 3 года назад
Great tutorial. I had some difficulty when deploying to a production server so I may be able to help others. If you deploy to prod, and can only access your page via port 8080, update docker-compose-deploy.yml ports value from "8080:8080" to "80:8080".
@galaktoza
@galaktoza 3 года назад
Did you deploy it on VPS Linux image? If so, does it work?
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
That's right. Also keep in mind that you might need to open the port via security rules for your VM.
@tahuite
@tahuite 3 года назад
Amazing video just what i was looking for but have 2 questions, why use static-data:/vol/static instead of actual folder static-data:/vol/WEB/static ? and in settings.py why use STATIC_URL = '/static/static/' instead of STATIC_URL = 'static/' ? thanks!
@Rochie
@Rochie 3 года назад
Mint tutorial!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you!
@jaronbardenhagen246
@jaronbardenhagen246 3 года назад
Hi, good tutorial ! Do you know any good Tutorial which explains how to set up Django with Docker on AWS EB? AWS don't have a documentation.
@alessandroalberga3801
@alessandroalberga3801 3 года назад
Legend!!
@lucianawaka
@lucianawaka 2 года назад
Thank you! =D
@kirillkruglov1418
@kirillkruglov1418 3 года назад
Great ! I have used this tutorial to deploy CRUD project, ant i have an issue: when i make POST or enter name & password on admin page, i get SERVER ERROR (500) What can be the problem? Any help appreciated!
@tsmets
@tsmets 3 года назад
Excellent ! Now this is OK to run "as such". However, a quick & short explanation on : 1. How the docker containers are arranged one with each other ? django is always deployed with 2 containers while I could be sufficient (no?). 2. Why do we create a Docker container to generate the statics ? Would have bring this one step further ! I looked at all the comments and wonder who are the 17 idiots who gave you a down thumb. Great job.
@shreem6447
@shreem6447 3 года назад
Thanks for sharing this walk through. I am stuck with an error in the final step when I run "docker-compose -f docker-compose-deploy.yml up --build" , I get: "app_1 | python: can't open file 'manage.py': [Errno 2] No such file or directory". Can anyone help me resolve this...
@lbb2rfarangkiinok
@lbb2rfarangkiinok 2 года назад
Sounds like you might have problems with your project file structure. You should have a project fold containing the dockerfile and dokcer-compose as well as requirements. Then create django project called app. The manage.py needs to be in there. Check the file structure in the source code for clarity.
@aniruddhapandit
@aniruddhapandit 4 года назад
Hiya, when we say app in the docker-compose.yml is it the app name ? Suppose my app name is projectx, would I put projectx instead of app: in the compose file ? Thanks.
@umamaheshwar7411
@umamaheshwar7411 3 года назад
I got the same doubt. Someone help
@erickfis2008
@erickfis2008 2 года назад
I was looking for explanations on the environment variables. How to pass them to cloud build or any other ci-cd service?
@Sparky-Vlogs
@Sparky-Vlogs 3 года назад
Hello sir, I'm facing WORKER TIMEOUT issue for Dockerized Django Application, can you please help me?
@muhmdhsn313
@muhmdhsn313 3 года назад
Thank you I've got a problem with static file, the css and js of admin not loaded!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Probably check your volume mapping and URL configuration for the static files.
@akshaybhadange2492
@akshaybhadange2492 3 года назад
great !!!
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thank you!
@shreem2381
@shreem2381 3 года назад
Thanks a lot for sharing this in-depth hands on session. I kinda got lost towards the end as there was no indication that your app was successfully deployed in the production environment :( . After the last step, when I access the app locally at port 8080 (and the /admin route as well), after I login I get Server Error(500). Any ideas how to resolve this... I have followed all the steps and pulled the docker image in AWS EC2 instance(regardless of the environment), and now would you please share steps on how to verify that all's working as expected. Once again I learnt a lot about the dos and don'ts from your session! :)
@juancarloselorriaga6171
@juancarloselorriaga6171 3 года назад
You're amazing. Thank you very very much. Does this exact same configuration works on an asgi app? I made changes to one of my apps since I'm using Django Channels and I want to deploy my project with a neat setup as you propose in this video. Any suggestions?
@juancarloselorriaga6171
@juancarloselorriaga6171 3 года назад
Everything is working except my websockets. Any resources can help!
@keshavarzpour
@keshavarzpour 2 года назад
thanks for the upload, but have question, how can i link to media folder , where ever i tried , in root or next to static folder, i get error, i don't know hw link my media folder
@ladyking83
@ladyking83 3 года назад
Hello Mark, one question: is there a reason why you haven't dockerized postgres db in dev mode resp. add db service in docker-compose.yml? thanks in advanced.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Sorry not sure what you mean? We do put PostgreSQL as a service in docker-compose.yml.
@ladyking83
@ladyking83 3 года назад
@@LondonAppDeveloper i meant until 18:00 there was no db service that starts a postgres container. why is that?
@omkarchavan2259
@omkarchavan2259 3 года назад
i am getting error /bin/sh: apk: not found, on running docker-compose up
@RakeshSharma-df2ie
@RakeshSharma-df2ie 3 года назад
How can we pass the allowed host dynamically from docker run command , because i want to run this in aws ec2 linux , so without the need of compose file, i have to run the container by pulling it into my ec2 instance. here is the below error i got: error: Invalid HTTP_HOST header: '11.232.140.160:8080'. You may need to add '11.232.140.160' to ALLOWED_HOSTS. command: docker run -p 8080:8080 rakesha/django_docker:1
@LegionLeague
@LegionLeague 2 года назад
OMG, what a great video and it makes it so painful that it's missing a, say, Heroku deployment at the end. This would have been a one-stop shop for dockerizing an app.
@alleviate8832
@alleviate8832 3 года назад
Great Video...Please make a video of deploying this project on google cloud/AWS
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks for the suggestion, I'll keep it in mind for future content.
@HuyNguyen-kd5vz
@HuyNguyen-kd5vz 3 года назад
@@LondonAppDeveloper yes, please
@SirStrategist
@SirStrategist 4 года назад
Hello and thank for usefull video. I use ubuntu(if it matters) and when compose docker-compose-deploy I have error PermissionError: [Errno 13] Permission denied: '/app/vol'. It relates to created user for app. Because if I not switch to it it works fine. RUN adduser -D manager RUN chown -R manager:manager /vol RUN chmod -R 755 /vol/web USER manager, as manager it has no rights to collectstatic in entrypoint.sh but seems that it should be able to do it. I have o idea what's wrong. May be I can suggest some where should dig?
@mcn1034
@mcn1034 4 года назад
Hi. Im getting the exact same error [Errno 13] Permission denied. Have you had any success finding a solution?
@aashayamballi
@aashayamballi 4 года назад
I had one doubt, you copy the project to the container, install dependencies and packages, create the directory for media and static files and then you create a user and provide the directory with permission with the created user. so whatever the project files like hello_world, app, and manage.py will not have that user permission right? Is it okay to keep it as root user permission for those files or will it change the user permission for those too?
@LondonAppDeveloper
@LondonAppDeveloper 4 года назад
It's fine if the files are owned by root as long as they have the execute permission for "other".
@aashayamballi
@aashayamballi 4 года назад
@@LondonAppDeveloper thank you! Could you please make a video on deploying django in swarm mode and keep nginx infront to receive all the http request.
@shivamtrivedi4669
@shivamtrivedi4669 3 года назад
Why did we use the STATIC_URL as /static/static and not only /static? because we are just using /static in the nginx config.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Because we use /static/ to map all static files, and /static/static/ is going to be for files generated by collectstatic and /static/media/ will be for media files uploaded by the user. It might be less confusing to use something like /webdata/static/ and /webdata/media/.
@soldierdorty1872
@soldierdorty1872 3 года назад
who do we deploy from windows?
@jorgeterence577
@jorgeterence577 9 месяцев назад
Thank you very much for the tutorial! It's really helping with my conclusion project. There's one detail that isn't covered that I got stuck on: in the video you seem to be using SQLite as a database. I'm using MySQL on a remote server and installing the dependencies causes the Docker image to crash. Do you have any tips?
@LondonAppDeveloper
@LondonAppDeveloper 9 месяцев назад
That's great, thanks for watching. You would set it up using environment variables to point to the remote server. So docker-compose.yml would have environment variables (pulled from .env file for secrets) and then settings.py would be configured to pull the MySQL database details from the env vars. Here is an example: github.com/LondonAppDeveloper/c2-recipe-app-api-2/blob/main/docker-compose-deploy.yml#L12 In that example we are using a DB hosted with Docker Compose, but you could just exclude the db: service and replace the configuration with the target DB if your DB is hosted elsewhere.
@robsonjunior2483
@robsonjunior2483 3 года назад
23:45 Will it copy to /etc/nginx/conf.d/ of the host system or docker nginx image (container)?
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
It's copying default.conf from your project directory to /etc/nginx/conf.d on your Docker container. It won't impact /etc/nginx/cond.d on the host system.
@robsonjunior2483
@robsonjunior2483 3 года назад
@@LondonAppDeveloper Oh that's great! Thank you!
@PAVANKUMAR-vj8oi
@PAVANKUMAR-vj8oi 3 года назад
nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
@philipmutua
@philipmutua 3 года назад
Local development works fine but when setting up nginx I ended up getting the following error: nginx: [emerg] host not found in upstream "app:8000" in /etc/nginx/conf.d/default.conf:2
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Double check there aren't any errors in your default.conf file.
@SKhan2312
@SKhan2312 2 года назад
Any idea how you would implement the http2 end to end solution? Happy to pay you for your help london app developer
@ragupathynarasimhan
@ragupathynarasimhan 3 года назад
Hi Mark, Thank you so much for your wonderful videos and it was a great learning for me. Furthermore, i need your help to resolve the below issue mentioned in the "docker-compose-deploy.yml". While execute the final step of build, i getting the below error. My OS: WINDOWS -10 Pro Error: The Compose file '.\docker-compose-deploy.yml' is invalid because: Unsupported config option for services.volumes: 'static_data' Please to hear you soon.
@kbnissanov
@kbnissanov 3 года назад
volumes needs to be at the same indentation with services i.e. services: #... volumes: static_data:
@RowsTez
@RowsTez 4 года назад
Hello! it gives me an error: error: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
@rajeshputhsakayala1896
@rajeshputhsakayala1896 3 года назад
I am also getting the same error. Did you find any solution? Thanks
@olorunsholamatins1680
@olorunsholamatins1680 Год назад
How tdo you configure it with ssl
@sepehrnematollahi1151
@sepehrnematollahi1151 3 года назад
GREAT VIDEO! I just don't understand why he changed the STATIC_URL to "/static/static/". Any help is appreciated.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks so much. STATIC_URL is the config that determines the URL path prefix for the static files (so if you have a static file called `main.css`, it would be `/static/static/main.css`). The MEDIA_URL config is similar, but instead of for the static files (which are stored with the project), it's for the media files that are uploaded to the project at runtime. We set STATIC_URL to `/static/static` and MEDIA_URL to `/static/media` and because then inside our nginx config we can set the alias for `/static` to `/vol/static` which will contain both `static/` and `media/` directories. This means the nginx proxy can handle both `static/` and `media/` URLs with one single location block here: github.com/LondonAppDeveloper/demo-django-docker-nginx-prod/blob/master/proxy/default.conf#L4 Django URL and media files are actually very confusing, especially when combined with Docker volumes. If you want to learn more, I'd suggest reading the official docs here: docs.djangoproject.com/en/3.1/topics/files/
@isaachatilima
@isaachatilima Год назад
How can I have the static files outside the app? when I move the folder I get 404 error
@wassim5622
@wassim5622 3 года назад
is it okay to just push to docker hub, go inside the production server pull the image and run it ?
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
That's one way to do it, yet.
@QwertyUiop-mn4nt
@QwertyUiop-mn4nt 4 года назад
Can we export this docker image and run this app in any machine now?
@LondonAppDeveloper
@LondonAppDeveloper 4 года назад
Yes
@serious6037
@serious6037 2 года назад
Please tell me , answer me bro, will this tutorial be good for windows10?
@pradyumg
@pradyumg 3 года назад
I know that WSGI and gunicorn work the same in a production environment so why did you prefer to use WSGI in docker?
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
There are many benefits to using Docker. 1) Check the Dockerfile and configs into code base, 2) Less server setup to deploy app - simply install Docker and run the containers, 3) Avoid server overhead completely using serverless technologies like Heroku and ECS Fargate... These are just some of the reasons.
@RohitShindeV1
@RohitShindeV1 4 года назад
I'm new to this. why do we need Nginx if we are deploying django app using uwsgi ? also can we increase uwsgi workers inside docker?
@LondonAppDeveloper
@LondonAppDeveloper 4 года назад
NGINX is used to serve the static files (JS, CSS, Images, etc.) and uWSGI is used to execute the Python code. Although uWSGI _can_ serve these static files, it's not recommended because it's not optimised to do so. NGINX is designed to serve these types of files at scale, which is why we use NGINX to handle them and leave uWSGI to do what it does best, which is run Python code.
@SamirMamude
@SamirMamude 3 года назад
Great tutorial, take a look on CaddyServer to make proxy, better than nginx in my opinion.
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Thanks for the feedback! I'll take a look at CaddyServer.
@malikimran8604
@malikimran8604 3 года назад
Hi how can deploy the same container to Azure? can you help please?
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Sorry no idea as I've not used Azure.
@kamrandurrani93
@kamrandurrani93 3 года назад
This site can’t be reachedThe connection was reset. on port 127.0.0.1:8000/. it works fine when used without docker but with docker-compose up it is giving site can't be reached please help
@aditmodi
@aditmodi 3 года назад
Hi, great video. I have a dockerfile which is using gunicorn to run django application. The problem is while creating a dockerfile gunicorn uses certain ip and port, what should I specify for those values. I tried to do something like this: CMD ["gunicorn" ,"-b" ,"127.0.0.1:8000" ,"my_project.wsgi"] it does not work. CMD ["gunicorn" ,"-b" ,"0.0.0.0:8000" ,"my_project.wsgi"] but this works. why does this happen, how to solve this issue. my goal is to deploy my django application using docker . create a ci/cd solution for my django app.
@JustusWeiss
@JustusWeiss 3 года назад
Hey, thank you for the tutorial! I just get stuck at 17:40 (docker compose-up) and can't figure out why :( When I enter 'docker compose-up' I get the message: ERROR: The Compose file '.\docker-compose.yml' is invalid because: Unsupported config option for services.app: 'enviroment' I didn't find any information about this problem on the internet and tried differend virtualenvs. Does someone have the same problem or knows an answer ? Best regards, Justus
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Sounds like you might have an indentation issue in docker-compose.yml. Double check it matches the example.
@JustusWeiss
@JustusWeiss 3 года назад
London App Developer Thank you for the answer! I deleted the environment part and then it worked because it only contained the debug part. I am currently doing your advanced Rest API course on Udemy and now everything with Django and Docker works as expected. Best regards, Justus
@skyblaze6687
@skyblaze6687 3 года назад
wish u included other video as well no issue i will make them free
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Sorry but I don't understand.
@mrkio7683
@mrkio7683 3 года назад
when i run docker-compose up it gives me an error /bin/sh: apk: not found ERROR: Service 'app' failed to build : The command '/bin/sh -c apk update && apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers' returned a non-zero
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
This is possible because of a typo in your Dockerfile or that you are using a different base image.
@harshgupta2874
@harshgupta2874 Год назад
great tut
@user-zc7hl4db7g
@user-zc7hl4db7g 3 года назад
It seems difficult, but I'll do my best!😁
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Hope it worked out.
@khlchs2231
@khlchs2231 3 года назад
PROBLEM : with the alpine version and the apk add ..... you provided , i couldn't install pillow :'( , any ideas on how to fix ?
@LondonAppDeveloper
@LondonAppDeveloper 3 года назад
Strange. Are you sure your code is the same?
@khlchs2231
@khlchs2231 3 года назад
@@LondonAppDeveloper thank you sir for answering, yes, from what i googled i think pillow needs other dependencies jpeg-dev, zlib but even adding them after the linux header didn't fix my issue
@PAVANKUMAR-vj8oi
@PAVANKUMAR-vj8oi 3 года назад
how to open this in mobile after deploying ?
Далее
Deploying Django with Docker Compose
2:24:50
Просмотров 87 тыс.
The 4 best ways to deploy a Django application
7:01
Просмотров 115 тыс.
когда мучает жажда // Eva mash
00:58
Просмотров 331 тыс.
Yeni Özbək Mahnisi Yoxsa Vefali Reqsi? 😍
00:36
Просмотров 2,9 млн
100❤️
00:19
Просмотров 2,9 млн
Dockerizing a Django REST Framework Project
16:58
Просмотров 53 тыс.
Building a Django Docker Container
34:11
Просмотров 21 тыс.
Dockerize Django App
18:16
Просмотров 52 тыс.
When you have 32GB RAM in your PC
0:12
Просмотров 2,1 млн
Acer Predator Тараканьи Бега!
1:00
Просмотров 239 тыс.