I used separate Dockerfile for nginx and django so that we can have custom instructions and can build as per the instructions. For mysql used the default base image, however we can have a Dockerfile for mysql as well. Its just a matter of preference and depends on use case. Thank you.
thank you sir its the most clear video on explanation, but one i have MySQL community server , and using some third party software's for backup, so can we connect Django docker to the MySQL of localhost
So glad to hear that it helped. If I understood correctly, u r trying to connect django running in docker to mysql running on host machine? If this is the case, very easily we can connect django running in docker to mysql running on localhost. All you need to do is to change the mysql connection string in django to point to localhost instead of docker service name. hope this helps
you may need to install these dependencies globally to be able to install mysqlclinet in your virtual environment: sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Thank you for that video that was what i was looking for. Keep it like you do it thank you
I am so happy to hear that. Thank you
ThankYou so much for this video. very helpful..
I am happy to hear that. Thank you
Hello sir, thanks for your time and efffort , question here is why we have 2 dockerfile? what is the reason . thanks and waiting for your respond.👍
I used separate Dockerfile for nginx and django so that we can have custom instructions and can build as per the instructions. For mysql used the default base image, however we can have a Dockerfile for mysql as well. Its just a matter of preference and depends on use case. Thank you.
thank you sir its the most clear video on explanation, but one i have MySQL community server , and using some third party software's for backup, so can we connect Django docker to the MySQL of localhost
So glad to hear that it helped. If I understood correctly, u r trying to connect django running in docker to mysql running on host machine?
If this is the case, very easily we can connect django running in docker to mysql running on localhost. All you need to do is to change the mysql connection string in django to point to localhost instead of docker service name. hope this helps
you may need to install these dependencies globally to be able to install mysqlclinet in your virtual environment:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Yes connecting MySQL with python requires Mysqclient which in turn requires dev tools and other packages. Thanks
very helpful, for static files are you giving directives in the nginx conf?
Yes for rendering static files, need to provide alias in nginx.
great work well explained.But i have a question.If i want to pass env variables to a nuxt application how should i do it
You can export env variables to container, either in docker compose file or dockerfile
So thanks you
Thank you
Why can't we add the migrate command to the docker compose??
Yes we can do that
unable to install mysqlclient, whats the solution?
mysqlclient requires python dev tool as well as MySQL dev tools. Pl refer to documentation pypi.org/project/mysqlclient/