Let's create a CRUD Rest API in Python using:
Django (Python framework)
Django Rest Framework (for the Rest API)
Postgres (relational database)
D...
For further actions, you may consider blocking this person and/or reporting abuse
Hi Francesco,
First of all, a huge thanks for for putting in so much effort in creating this comprehensive and easy to follow step-by-step tutorial.
I was able to successfully run
docker compose build
but when I run
docker compose up
I get this error
I ran
docker compose down
checked the logs for errors and I could not find any.
did you check the video on YouTube?
Not yet. I will do that some other day. Thank you.
no problem
Update:
I get the same error even after creating the database and a table in PostgreSQL and running
docker compose build
. Below is the output of
docker compose up
.
did you manage to solve it?
Not yet. If I try this once more and face any issues, I will update.
ok good luck
Cool.
I tried this to learn a bit about docker. I don't think I understand how it is supposed to work.
When I first went through the steps I've got an error:
Which is pretty obvious, I forgot to import include, my issue is I don't know how to update the code in the container.
I would expect rebuilding should fix that, but it doesn't.
I have also tried to remove everything and retrace my steps.
line 2. Did you import the include?
That's exactly how I tried to fix that. I have that code in my project folder, but no matter what I do the container seems to be stuck with the old code.
Do I need to change Dockerfile or docker-compose.yml to make sure files are overwritten when rebuilding?
did you try docker compose up --build?
Yes, that's what I said would expect to update the container.
That's my luck. I always run into some weird bugs. I will have to try later on my other pc.
I'd suggest to try again from scratch and when you find the error you let me know here. good luck
I have encountered some issues.
1.) I used Dbeaver to have an interface for my postgres database. But I got connection error says
FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
2.) The moment I run
docker compose up
I dont see output in terminal that is similar to the content of django.sh file.I am using a windows with linux subsysmtem using ubuntu. I run the djangoproject in ubuntu 22.04 linux subsystem.
But your project tutorial works fine if I use the standard procedure or standalone django and postgre, without using Docker.
But if I use docker, I encountered the error I said earlier
hi. for point one, it really seems like a wrong password issue, beecause it's trying to authenticate.
Did you check the youtube video?
thank
you are welcome
Nice 👍
Why not use a Django Rest Framework ModelviewSet instead?
With pagination too. 😁
Btw, you said you would use Python 3.10, not 3.7 😉
I just used this simple one.
you are partially correct, because I used Python 3.10 on my machine, that's the requirement just to run the django-admin CLI command
you odn't really need python 3.7 because you tun it inside a docker container.
I hope this was clear