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 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 ..
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 :-)
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.
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.
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.
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
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.
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".
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...
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.
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.
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!
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!
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.
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.
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.
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/
Thanks for the great vid! I tried to follow along but at the end received this error. How can I fix it? [emerg] 1#1: host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9 proxy_1 | nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
same error. it seems app it is not recognized by the nginx default.conf. 'app' there should be an ip address, should i cant figure out why it is not recognized.
i fix the error, app name refers to the name of the top folder of the app, where the docker-compose-deploy.yml is. you have to change app for the name of the folder and it will work.
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?
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.
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! :)
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?
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
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
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.
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
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.
Hi, I am getting below error while running this command ---> docker-compose -f .\docker-compose-deploy.yml up --build Starting demo-django-docker-nginx-prod_app_1 ... done Recreating demo-django-docker-nginx-prod_proxy_1 ... done Attaching to demo-django-docker-nginx-prod_app_1, demo-django-docker-nginx-prod_proxy_1 app_1 | standard_init_linux.go:219: exec user process caused: no such file or directory proxy_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration proxy_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh proxy_1 | 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?) proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh proxy_1 | /docker-entrypoint.sh: Configuration complete; ready for start up demo-django-docker-nginx-prod_app_1 exited with code 1 proxy_1 | 2021/03/20 11:16:58 [emerg] 1#1: host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9 proxy_1 | nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9 demo-django-docker-nginx-prod_proxy_1 exited with code 1
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?
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
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/.
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
ERROR: for main_ctnr Cannot start service main_server: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "entrypoint.sh": executable file not found in $PATH: unknown
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.
Getting this error message when I run docker-compose -f docker-compose-deploy.yml up --build Recreating c2568b22a934_demo-django-hello-world-starter-master_app_1 ... error ERROR: for c2568b22a934_demo-django-hello-world-starter-master_app_1 Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"entrypoint.sh\": executable file not found in $PATH": unknown ERROR: for app Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"entrypoint.sh\": executable file not found in $PATH": unknown ERROR: Encountered errors while bringing up the project. Any ideas?
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.
Hey, we will do... Currently working on some other projects (moving country/house being one), but we are planning to launch one more course and then update this course to use Django 3. Will keep you updated once it's available. Thanks for the support :)
*** Operational MODE: single process *** ModuleNotFoundError: No module named 'main_server' unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** 'main_server' = service name in my docker-compose.yml. (in your case = 'app')
@@samuelolayemi1930 On default.conf: "app" is your service name on docker-compose.yml. On entrypoint.sh: "app" is your directory name of your project (where contains manage.py).
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.
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
aww thanks man appreciate it.
Terrific video
I absolutely love how you've explained every single step in the dockerfile and conf files in detail
Dude, that explanation was perfect. You deserve way more views. Thanks!
Thanks Eric :D
Might be the best DEV teacher I’ve ever had. From Udemy to UA-cam, thank you so much Marc
Wow thanks man appreciate that :)
@@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 ..
The best dev channel, giving millions of information in a very short time.
Thanks mate, appreciate that :)
Damn Dude, just bought your course. Your explanation made my day.
Thank you so much.
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 :-)
Thanks for the comment, great to hear that. Are you abroad or in the UK but not commuting to London due to lockdowns?
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!
Thanks Andrew :)
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.
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.
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.
you are just incredible my brother from my mother.
Thanks! Glad you like the video.
@@LondonAppDeveloper but quick question how should i handle(properly configure) if i want to include media folder???
Love how this video is recommended to me AFTER I have created my docker image... Greate video!
Brilliant!
This is the best Django - Docker tutorial by far. You keep best practices and you do a very good job explaining! Thank you!
Thank you for that :)
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
Thank you!
It’s just out of this world explanation!!! God Level !!
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.
Thanks mark !! I love the way you present your content . Learned DjangoRest from your two courses :)
Thank you! We appreciate you supporting our content by buying our courses, and glad you like them :)
Well thought out and easily explained as usual by Mark....
Thanks so much!
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".
Did you deploy it on VPS Linux image? If so, does it work?
That's right. Also keep in mind that you might need to open the port via security rules for your VM.
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...
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.
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.
Great to hear that... Thank you!
Great tutorial, got a better understanding of what should be done when deploying django apps.
Thank you glad it was useful!
Respect for preparing this awesome presentation and sharing your knowledge. Thank you!
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!
My man! hats off for you! one can see with you that knowledge cannot be improvised, thanks a lot for this video!
Thank you! :)
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!
You are doing greate job with those tutorials :) waiting for more quality content like this one
Thanks so much =)
Seriously, thank you for this explanation. Very well done! Very thorough
Thank you a lot, solving my concern right now !
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.
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.
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.
Hey! This was one of the most useful tutorials I've come across!!
Thanks much!! This video helped me a lot & understood so much....
That was an awesome explanation.
Glad you think so! Thank you!
Thankyou for such a detailed explanation, I am able dockerize my project...
You are most welcome
thank you for this masterpiece
You're welcome, thanks for watching :)
I love your channel. Thanks for all the videos.
Absolutely great, man!
Thanks for sharing this ammmaizing course. I could understand what I understand and not. Best wishes,
Brilliant. Thanks so much for watching!
Great tutorial, agreed you deserve more views. Thanks a lot!
Thanks so much :)
Thank you for your great instructive video.
Thanks a lot! Useful and easy to follow
Thanks mate, appreciate that.
Simple, Fast, Usefull 👌👌
Thank you so much for this!
Glad it was helpful!
Thanks for this awesome guidance! It helped me a lot!
Glad to hear it helped!
Great Video...Please make a video of deploying this project on google cloud/AWS
Thanks for the suggestion, I'll keep it in mind for future content.
@@LondonAppDeveloper yes, please
GREAT VIDEO!
I just don't understand why he changed the STATIC_URL to "/static/static/".
Any help is appreciated.
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/
Thanks for the great vid! I tried to follow along but at the end received this error. How can I fix it?
[emerg] 1#1: host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
proxy_1 | nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
same
Also same
Same error
same error. it seems app it is not recognized by the nginx default.conf. 'app' there should be an ip address, should i cant figure out why it is not recognized.
i fix the error, app name refers to the name of the top folder of the app, where the docker-compose-deploy.yml is. you have to change app for the name of the folder and it will work.
This is what my next step, to deploy, but can't get to run my project with this. sad.
so much help, very useful tutorial
Happy to be of service!
Definitely appreciate this
Thank you! I appreciate you taking the time to watch our content and leave a comment :) Best of luck.
Thank you , explanation was Great!!....
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?
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.
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! :)
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?
Hi. Im getting the exact same error [Errno 13] Permission denied. Have you had any success finding a solution?
Thank you sooo very much, this really helped me....
Great to hear, thanks for watching!
Thanks a lot, great tutorial!
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.
if you have included the database (mysql/postgres) settings that would have been a cherry on a cake
Thanks for the feedback, I'll keep this in mind for future content.
Mint tutorial!
Thank you!
awesome explanation --> thanks!
You're welcome, glad it was helpful and thanks for the comment :)
You know your stuff. Subscribed
Thank you!
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
Hello sir, I'm facing WORKER TIMEOUT issue for Dockerized Django Application, can you please help me?
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
This is possible because of a typo in your Dockerfile or that you are using a different base image.
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.
I got the same doubt. Someone help
Any idea how you would implement the http2 end to end solution? Happy to pay you for your help london app developer
How can I have the static files outside the app? when I move the folder I get 404 error
This video slaps harder than a latino mom's chancla! Fucking awesome! Thank you man.
Lol. Thanks?
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
nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
I was looking for explanations on the environment variables. How to pass them to cloud build or any other ci-cd service?
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.
volumes needs to be at the same indentation with services i.e.
services:
#...
volumes:
static_data:
Hi,
I am getting below error while running this command ---> docker-compose -f .\docker-compose-deploy.yml up --build
Starting demo-django-docker-nginx-prod_app_1 ... done
Recreating demo-django-docker-nginx-prod_proxy_1 ... done
Attaching to demo-django-docker-nginx-prod_app_1, demo-django-docker-nginx-prod_proxy_1
app_1 | standard_init_linux.go:219: exec user process caused: no such file or directory
proxy_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
proxy_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
proxy_1 | 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
proxy_1 | /docker-entrypoint.sh: Configuration complete; ready for start up
demo-django-docker-nginx-prod_app_1 exited with code 1
proxy_1 | 2021/03/20 11:16:58 [emerg] 1#1: host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
proxy_1 | nginx: [emerg] host not found in upstream "app" in /etc/nginx/conf.d/default.conf:9
demo-django-docker-nginx-prod_proxy_1 exited with code 1
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?
Everything is working except my websockets. Any resources can help!
Legend!!
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
Thank you! =D
Great tutorial, take a look on CaddyServer to make proxy, better than nginx in my opinion.
Thanks for the feedback! I'll take a look at CaddyServer.
amazing woooooooorks thanks!
thank you SO MUCH!
Thank you for watching, glad it was useful.
Please tell me , answer me bro, will this tutorial be good for windows10?
Why did we use the STATIC_URL as /static/static and not only /static? because we are just using /static in the nginx config.
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/.
thank you sir.
i am getting error /bin/sh: apk: not found, on running docker-compose up
nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)
SOLVED
Thank you
I've got a problem with static file, the css and js of admin not loaded!
Probably check your volume mapping and URL configuration for the static files.
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
Double check there aren't any errors in your default.conf file.
wish u included other video as well no issue i will make them free
Sorry but I don't understand.
great !!!
Thank you!
ERROR: for main_ctnr Cannot start service main_server: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "entrypoint.sh": executable file not found in $PATH: unknown
SOLVED
okay but how did you solve it?
@@AnotherAvaibleName I putted entrypoint.sh inside my Django project (together with manage.py) and on Dockerfile: CMD ["sh", "entrypoint.sh"]
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.
Getting this error message when I run docker-compose -f docker-compose-deploy.yml up --build
Recreating c2568b22a934_demo-django-hello-world-starter-master_app_1 ... error
ERROR: for c2568b22a934_demo-django-hello-world-starter-master_app_1 Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"entrypoint.sh\": executable file not found in $PATH": unknown
ERROR: for app Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"entrypoint.sh\": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.
Any ideas?
Double check your entrypoint.sh is being given execute permissions.
I know that WSGI and gunicorn work the same in a production environment so why did you prefer to use WSGI in docker?
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.
how to open this in mobile after deploying ?
Thanks Mark. Besides, can you please update the Dockerfile in the udemy course "Build a backend REST API with Python & Django?
Hey, we will do... Currently working on some other projects (moving country/house being one), but we are planning to launch one more course and then update this course to use Django 3. Will keep you updated once it's available. Thanks for the support :)
like and subscribed! have you got some udemy curses translated (subtitled) in spanish language?
Great video! Any ideas why I keep getting the error below??
invalid request block size: 21573 (max 4096)...skip
Thanks
Hey Nick, when do you get that error?
How tdo you configure it with ssl
*** Operational MODE: single process ***
ModuleNotFoundError: No module named 'main_server'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
'main_server' = service name in my docker-compose.yml. (in your case = 'app')
SOLVED
Pls how did you solve it
@@samuelolayemi1930 On default.conf: "app" is your service name on docker-compose.yml. On entrypoint.sh: "app" is your directory name of your project (where contains manage.py).
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.
Sorry not sure what you mean? We do put PostgreSQL as a service in docker-compose.yml.
@@LondonAppDeveloper i meant until 18:00 there was no db service that starts a postgres container. why is that?