Super useful. That just worked with my old project. Thank you, Mark!
@matej-world6 жыл бұрын
I just wanted to start learning Docker ... thanks, for this great intro!
@LondonAppDeveloper5 жыл бұрын
You're welcome Matej! Glad you found it useful.
@aV5d9nlUBQ96 ай бұрын
Exactly what I needed. Thanks!
@LondonAppDeveloper6 ай бұрын
Splendid.
@usamakaleem83783 жыл бұрын
Great but i was also expecting the pg_admin setup and also change user for postgres and password
@Zzzzzzzzzzzzzzzzzzzzr6 жыл бұрын
Question wouldn’t all your previous data be lost as in the data you saved before you plugged in to the new database
@gabrieldjebbar54734 жыл бұрын
You need to update in the requirements.txt Django==1.11.17 (or more), otherwise there is failure when building.
@LondonAppDeveloper4 жыл бұрын
Thank you
@WarrenBey Жыл бұрын
Amazing he was able to run a PG image without a PG password.
@tsoonamik5 жыл бұрын
You are my superhero. Saved a lot of my time
@enricosaccheggiani31923 жыл бұрын
Perfect , I have this problem. How to deploy this site not to localhost but hosting on a service like Google cloud Run. I am trying to deploy a site like this on a platform like digital Ocean or GCP but doesn't work. And more important, if I deploy this website where is the permanent storage? If I deploy my site on localhost the real database is on : volumes: - ./data/db:/var/lib/postgresql/data ./data/db but when it's deployed on a extern platform , where are effectly stored the data ? Thanks a lot if you can tell me the answer All the best regards
@giorgiberia5 жыл бұрын
i din't change anything but docker compose fails saying can't open file 'src/profiles_project/manage.py': [Errno 2] No such file or directory
5 жыл бұрын
Same issue here
@SuperDiana9974 жыл бұрын
Replace the manage.py path to `./src/profiles_project/manage.py` when you are running migrations as well as the web server command in the docker-compose.yml file. Worked for me!
@peternjenga50455 жыл бұрын
Worked perfectly! Thanks mate.
@nielsSavantKing Жыл бұрын
@London App Developer. So but it is better to omit de db container in production? Because I have read that it is not good to put a database in a docker container
@yvoncomeau6 жыл бұрын
Excellent demo. Thanks!
@nitishpatkar61906 жыл бұрын
Could you perhaps also make a video to demonstrate how can we populate this freshly created database in the container with the data in existing database? I had an existing Django rest project set up with MySQL which already had some data saved. I decided to dockerize mmy project and followed both your tutorials. I can access my application at localhost. Now, I really would like to see how I could populate this database in the docker container with the data in my local MySQL database.
@LondonAppDeveloper5 жыл бұрын
Hey Nitish, thanks for the comment, I'll definitely keep this in mind when making future content.
@JoseAlvarez-dl3hm3 жыл бұрын
it totally work, amazing, thanks a lot, I will buy your udemy courses for sure.
@LondonAppDeveloper3 жыл бұрын
Fantastic, thanks José.
@rajashreesekar10976 жыл бұрын
Cool Video.. I was looking for this one. I wish you could have included where to find the data in postgres container.
@nielsSavantKing Жыл бұрын
HI, first you start your containers with docker-compose up. Then do docker ps -a . Then you will see the running containers. Then you will do a: docker exec -it nameContainer bash. Then you have to switch to the roler from your database: psql -U roleDatabase. And then with \d+ you will see all the tables in that database. and you can do just a select*from tableName and see all the data from that table.
@yashm054 жыл бұрын
loved your video, but im getting this error when i ran migrate commad django.db.utils.OperationalError: could not translate host name "db" to address: Name or service not known
@tylerdurden30734 жыл бұрын
same
@LondonAppDeveloper4 жыл бұрын
Maybe try running `docker-compose down` followed by `docker-compose up`... It could be that the database didn't start in time for some reason.
@globalassistance10504 жыл бұрын
environment: - "POSTGRES_HOST_AUTH_METHOD=trust" in db service solved this for me
@ezadviper6 жыл бұрын
So now, how to connect to those databases in postgres container through pgadmin for backup, install plugins etc .. ?
@ahmedshawkat61014 жыл бұрын
there is an image for pgadmin you can configure it to run as a new image and bind it to a different port give me a second and ill show you how it is done
@ahmedshawkat61014 жыл бұрын
Here is the image link hub.docker.com/r/dpage/pgadmin4 Here is the code to set it up and running! pgadmin4: image: dpage/pgadmin4 ports: - 8050:80 environment: PGADMIN_DEFAULT_EMAIL: postgres@localhost PGADMIN_DEFAULT_PASSWORD: password
@Anyonelser27 күн бұрын
Thank you 🎉
@gouthambolt4 жыл бұрын
Took your rest api course. Was pretty boring but probably best course I have done. Help me get a ton of important skills and got lots of oppertunities. thank you! _/\_
@LondonAppDeveloper4 жыл бұрын
Lol thank you for taking our course. Sorry it was boring but glad to hear the boredom paid off in the end :)
@koustav28263 жыл бұрын
Hello I'm facing an error: django.db.utils.operationalerror could not translate host name "db" to address: Temporary failure in name resolution I tried by adding links: and network: in docker compose file, but still it's showing the same
@@minhajuddinansari561 Wow that helped a lot, thank you !
@snowpeak6 жыл бұрын
How do you deploy this to a VPS?
@saleee_63 жыл бұрын
Thank you brother!
@jeetpatel28284 жыл бұрын
can you please do it with the mysql as well
@isaachatilima Жыл бұрын
Hi, I am in need of a tutorial for deploying a Django Docker app to Azure which will point to Azures PostgreSQL resource. Do you have that course?
@ashlingabrielrajan24964 жыл бұрын
Everything went well as per the tutorial . only when I run migrate I hit in to a trouble with psycopg2. Any ideas or suggestion? django core exception .Improperly configured: Error loading psycopg2 module :No module named 'psycopg2'
@LondonAppDeveloper4 жыл бұрын
Double check that this dependency is in your requirements.txt and try running `docker-compose build` again
@rhonaldjr5 жыл бұрын
Awesome, discovered just in time to migrate my db from sqlite to postgresql. Still stuck where docker spit out no such file or directory to run migrate command.
@kanakorn.h5 жыл бұрын
psycopg2 ---> IMHO pronounced "psycho pg two" LOL
@avtutube4 жыл бұрын
Hi, can you create a Django using a mySQL database app into a Docker container. Great videos! Thank you.
@LondonAppDeveloper4 жыл бұрын
Should be more or less exactly the same, except you will use a MySQL docker image and configure Django for a mysql backend.
@36plain544 жыл бұрын
many many thanks!
@LondonAppDeveloper4 жыл бұрын
Most welcome!
@vinsmokearifka4 жыл бұрын
thanks for the tutorial, but i got `django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres"`
@36plain544 жыл бұрын
I had a similar problem. Check to see if your database specifications in local 'settings.py' has the 'PASSWORD' field. If not, you'll need to define one (simply add 'PASSWORD': 'postgres' for now)
@vinsmokearifka4 жыл бұрын
@@36plain54 thank you
@zbigniewsztobryn3 жыл бұрын
Everything looks so smooth, but if it comes to publish my own project I get one error after another. I just go one by one but this one drives my crazy: django.db.utils.OperationalError: could not translate host name "dummy_endpoit" to address: Name does not resolve
@magodelviento6 жыл бұрын
How can you access to postgresql outside the container now? jus like a normal django app because now the host is 'db' .
@tommaso98394 жыл бұрын
When running docker-compose up, I get web_1 | python: can't open file 'src/profiles_project/manage.py': [Errno 2] No such file or directory byob-profiles-rest-api-docker_web_1 exited with code 2 even if my manage.py is in D:\...\byob-profiles-rest-api-docker\src\profiles_project how is this possible?
@vr95404 жыл бұрын
It might be fixed using python:3.6.12 version of python in the Dockerfile.
@nikitakurabtsev12222 жыл бұрын
Thank you.
@nitishpatkar61906 жыл бұрын
It helped me me a lot!
@jeremiahj23145 жыл бұрын
docker-compose up fails with'Error: Service 'web' failed to build unexpected EOF' any help would be appreciated. great vid.
@toniehubert3 жыл бұрын
Why are you in bieszczady mountains :O?
@LondonAppDeveloper3 жыл бұрын
The photo is from Banff National Park (Canada).
@elenaperez63274 жыл бұрын
Great video! I would love your advice. I have a django app which has a mysql db which I need to change over to postgres. Can I simply make the changes in the docker-compose.yml file or do I need to search for any mysql reference thoughout the whole app and change it to psql? Thank you for your help, I can't find much info about it online.
@LondonAppDeveloper4 жыл бұрын
Thanks! That depends... Is there a requirement to migrate data over or just create a fresh DB in PostgreSQL? If you need to migrate data, you'll probably need to run some SQL exports or potentially create a custom script for exporting/importing data. Otherwise you should be good to just switch the MySQL service to use Postgres and update your database backend in Django. Also, you would need to check your code for any hard dependencies on MySQL (for example, specific MySQL fields used in models, raw queries, etc...).
@thedemonlord92324 жыл бұрын
how can you access that database? when I add network_mode: bridge it fails building
@alkanecker92506 жыл бұрын
Hi London, excellent video and very clear. I've followed all your steps exactly however I'm still running into the same error which brought me to your video; any call to manage.py or attempts to run the app with docker run into the following error: - django.db.utils.OperationalError: could not translate host name "db" to address: Name or service not known any idea why this might be? running on a linux server with: docker version == 18.03.1-ce django version == 1.11.1
Hello, I have created django app and connect to Postgres. But I need help on some .. could I send the document that I need help.
@LondonAppDeveloper3 жыл бұрын
Sorry but I don't have capacity to offer one to one debugging... I recommend posting on Stack Overflow or asking on community IRC.
@kingroc36514 жыл бұрын
How do you migrate the actual data in tables from previous sqlite to postgresql? I did't see this in your video.
@LondonAppDeveloper4 жыл бұрын
Hey yes that's not covered in the video. This would not be straightforward unfortunately. The easiest way might be to write a script that exports the tables to CSV, then write another script to import them from CSV files into PostgresSQL.
@ezequiasrocha30373 жыл бұрын
What is the version of Django you are using here?
@LondonAppDeveloper3 жыл бұрын
Quite an old version (1.11) but the steps should be the same for Django 3
@alihusham15603 жыл бұрын
I think psycopg2 updated to psycopg2-binary
@LondonAppDeveloper3 жыл бұрын
No those are different things. The -binary one is precompiled. I understand it's better to compile it so it's optimised for the OS.
@sushichanel72996 жыл бұрын
Hi , I have this eror when type: sudo docker-compose up Building web Step 1/7 : FROM python:3 ERROR: Service 'web' failed to build: Get registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:56049->[::1]:53: read: connection refused Please help me on this.
@rodrigomartinez14144 жыл бұрын
I have problems with the repository that you uploaded, at the moment of raising docker compose, it marks the following error: --WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or` docker-compose up --build`-- and it does not allow to create the Django service, I tried to do it in playground and it also sent me an error
@LondonAppDeveloper4 жыл бұрын
Is it a warning or an error? Warnings typically do t prevent it from working, they just let the dev know something might need to be fixed or changed in the future.
@darren11075 жыл бұрын
If you're watching this video and getting errors with the docker-compose command, you need to check this thread: stackoverflow.com/questions/51959890/docker-compose-and-django-generator-syntax-error/54437379#54437379?newreg=752e0329860c42699469069618b03fea "Your Django version is not compatible with Python 3.7 So make these changes In your Dockerfile FROM python:3.6 Restart docker using sudo service docker restart then sudo docker-compose up --build or sudo docker-compose run web python manage.py migrate and sudo docker-compose up --build" Also, if you have difficulty stopping your docker containers after starting this project: stackoverflow.com/questions/28069240/unable-to-stop-or-remove-a-container-in-docker-permission-denied-is-displayed linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/ This worked for me, but please, do read the articles, I'm a complete noob: "sudo aa-remove-unknown sudo service docker restart sudo docker container stop $(docker container ls -aq)"
@yassinsoltani27254 жыл бұрын
i can't find my database in pgadmin there is no server and no database everything is empty why please ?
@LondonAppDeveloper4 жыл бұрын
Unfortunately it's difficult to tell without seeing it. If the Django project runs (and migrations apply) then the data must be somewhere.
@KanikaDawar19974 жыл бұрын
I'm getting this error - web_1 | Is the server running on host "localhost" (127.0.0.1) and accepting web_1 | TCP/IP connections on port 5432? web_1 | could not connect to server: Cannot assign requested address web_1 | Is the server running on host "localhost" (::1) and accepting web_1 | TCP/IP connections on port 5432?
@LondonAppDeveloper4 жыл бұрын
Try stopping and starting the docker containers?
@evgeniy_melnikov7 ай бұрын
thanks a lot
@LondonAppDeveloper6 ай бұрын
You are most welcome
@josecortes35124 жыл бұрын
good stuff here thanks for your sup::port !
@LondonAppDeveloper4 жыл бұрын
Thank you too
@Lbmaniak5 жыл бұрын
Thx for work
@kroloskar6 жыл бұрын
docker app does not start...
@denizgms80835 жыл бұрын
add apache please
@carlosmardones64226 жыл бұрын
Hey London! Thanks a lot for upload this video! I have a issue... I does all of this video but when I run python manage.py migrate, this still save all information in db.sqlite3 and not in my PostgreSQL container... Someone has the same issue than can help me??
@carlostriumph3316 жыл бұрын
i dont know but when i make `python manage.py migrate`, this still save all information in db.sqlite3... someone can help me ? :/
@joeygras86 жыл бұрын
Did you change your django project's settings.py to use postgres instead of the default sqlite?
@pokegaiyui5 жыл бұрын
Dang I thought this video was how to connect to a Host Postgres DB and not a dockerized posgres.....
@bawantharajapaksha64175 жыл бұрын
psycopg2-binary
@WeirdSide6 жыл бұрын
Would you like to hear a poem?
@jonhpilsner36945 жыл бұрын
красавчик, чувак!
@aram694207 ай бұрын
7:20 You should definitely use psycopg-binary instead of psycopg
@LondonAppDeveloper6 ай бұрын
psycopg-binary is not recommended for production: www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary It's fine for learning and local development though.