Build a CRUD Rest API in Python using Flask, Postgres, Docker and Docker compose

  Рет қаралды 22,134

Francesco Ciulla

Francesco Ciulla

Күн бұрын

Пікірлер: 48
@ibiawosanya9233
@ibiawosanya9233 Жыл бұрын
Excellent tutorial, was a total beginner and now I created the Python Flask web application and Dockerized in less than 30 mins.
@francescociulla
@francescociulla Жыл бұрын
you are welcome! I will post this comment on Twitter soon
@matheusmagalhaes7054
@matheusmagalhaes7054 Жыл бұрын
A 29-minute video took me two days of study because I had never configured Docker on WSL before. I needed to learn the basics of Flask, Docker, and Postgres to successfully follow the tutorial. The content was amazing, and I managed to complete everything, although with some modifications. The assistance from ChatGPT was crucial in understanding concepts and commands, making the process more easier. Ty boss
@francescociulla
@francescociulla Жыл бұрын
you are welcome!
@ΡαφαήλΣαμωνάκης
@ΡαφαήλΣαμωνάκης 2 ай бұрын
Perfect! It works like a charm! You saved me so much time, thanks! NOTE! : I had an issue with the GET requests but i replaced "user.json()" with "user.toJson()"
@francescociulla
@francescociulla 2 ай бұрын
you are welcome!
@francescociulla
@francescociulla Жыл бұрын
Find Francesco: francescociulla.com 0:00 Intro. Architecture and project setup. Dependencies in requirements.txt 2:40 app file: Flask app, SQLAlchemy app, Model, test route 6:15: routes and CRUD controllers: Create, Read, Update, Delete 12:04 Dockerize the Flask application. Dockerfile 14:08 docker-compose.yml: flask app and Postgres services 18:00 Test Postgres container. test with Tableplus 19:45 Build the image (debug) and run the app service. Test endpoints 23:53 Bug fixing. Final test
@rojansapkotaofficial
@rojansapkotaofficial Жыл бұрын
Great One!
@francescociulla
@francescociulla Жыл бұрын
thank you so much!
@mrjmrezende
@mrjmrezende Жыл бұрын
When I run "docker compose up --build flask_app" I received the message: RuntimeError: Working outside of application context. This typically means that you attempted to use functionality that needed the current application. To solve this, set up an application context with app.app_context(). See the documentation for more information. Any suggestions to resolve this? Sorry, I'm beginner
@francescociulla
@francescociulla Жыл бұрын
are you using docker or just running the flask application?
@mihaiion5879
@mihaiion5879 Жыл бұрын
I had the same problem; for me it was because I changed the version from Dockerfile from `python:3.6-slim-buster` to `python:3.8` or even `python:3.10`
@LongBoy.0
@LongBoy.0 Жыл бұрын
@@mihaiion5879 I'm on python:3.8-slim-buster and getting the error OP described as well. When I changed back to 3.6 slim-buster, the error was solved
@zaki9815
@zaki9815 Жыл бұрын
My friend, you can use command "docker compose logs -f" for debugging
@francescociulla
@francescociulla Жыл бұрын
I know ;)
@zaki9815
@zaki9815 Жыл бұрын
@@francescociulla You know but you didn’t use it to figure out the internal error, it would be a good addition to use it in your video. Keep going my friend
@HarmanSingh-pb6ls
@HarmanSingh-pb6ls 5 ай бұрын
@@zaki9815 hey man can you help me out with this issue: whenever i run docker compose up --build flask_app" or docker compose up flask_db" i get the error as:o configuration file provided: not found
@radum_val
@radum_val 5 ай бұрын
@@HarmanSingh-pb6ls Check that you are in the proper folder that contains the Dockerfile.
@TheIaTaI
@TheIaTaI Жыл бұрын
Is code suggestions being suggested by an extension? Is there a similiar co-pilot in pycharm?
@francescociulla
@francescociulla Жыл бұрын
it is GitHub copilot
@michaeloneill3786
@michaeloneill3786 9 ай бұрын
Why did the API return HTML to Postman when you encountered the error? Shouldn't it have returned your generic JSON error message?
@francescociulla
@francescociulla 9 ай бұрын
I will try it out
@Useroftherisingsun
@Useroftherisingsun Жыл бұрын
Thank you sir, you saved me hours!!
@francescociulla
@francescociulla Жыл бұрын
glad to hear that!!!
@GauravSingh-ui3jr
@GauravSingh-ui3jr Жыл бұрын
API's all the endpoints are working fine, After containerizing it using docker the Database is created as per Table Plus. Test endpoint of the application is working fine. But I am getting error that no table exists. I tried multiple solutions from internet and chatgpt. Please help
@francescociulla
@francescociulla Жыл бұрын
it should be created by the flask app, please trey to follow step by step, running first the db container, then the flask app. works on my side
@koudjoura
@koudjoura 11 ай бұрын
good video , if i want to create 2 container , one for DB and other for the API, how can i process?
@francescociulla
@francescociulla 11 ай бұрын
hey, thnak you. this is es exactly what the videos shows, if something is not clear let me know!
@koudjoura
@koudjoura 11 ай бұрын
@@francescociulla yes i got it , thank you , but other question if I want to use docker to set an application hosting automation platform developed under Framework (python or PHP) how can I process , like what are the steps ?
@HarpreetSinghSohal-q5r
@HarpreetSinghSohal-q5r 3 ай бұрын
Docker Compose w/ PostgreSQL - psql Password Authentication failed - This is the error I got, after breaking my head for some two days I realised that I just had to stop the local postgres service to free the port. Once I did that, the error disappeard.
@francescociulla
@francescociulla 3 ай бұрын
glad you solved,, it! yes that's kind of annoying
@susmitadey6735
@susmitadey6735 Жыл бұрын
I'm unable to create users. Help me.
@francescociulla
@francescociulla Жыл бұрын
are you doing post requests? was the database created?
@susmitadey6735
@susmitadey6735 Жыл бұрын
@@francescociulla Yes. I'm doing post requests. But the database is not getting created.
@francescociulla
@francescociulla Жыл бұрын
@@susmitadey6735 you should have it as soon as you run the flask app. do you get the list of empty users? did you try to just clone the repo and spin up the services?
@susmitadey6735
@susmitadey6735 Жыл бұрын
@@francescociulla I got the list of empty users after running the flask app. I didn't tried to clone the repo. I tried to code along with you in the video.
@francescociulla
@francescociulla Жыл бұрын
@@susmitadey6735 if you have the empty users it means the database is there. try again with the post request and check the values
@ankitsoni534
@ankitsoni534 11 ай бұрын
Hello I need some help,
@francescociulla
@francescociulla 11 ай бұрын
hello, that's too generic. about the video?
@fargatepb-tb1rl
@fargatepb-tb1rl 7 ай бұрын
Why i can't connect to db in postgres, i get this error from table plus: connection to server at "localhost" (::1), port 5432 failed: FATAL: la autentificaci�n password fall� para el usuario �postgres� I did everything the same until I reached the command: docker compose up -d flask_db help please.
@francescociulla
@francescociulla 7 ай бұрын
The password for the db is wrong
@fargatepb-tb1rl
@fargatepb-tb1rl 7 ай бұрын
@@francescociulla the password is postgres , i don’t know why it does not work
@fargatepb-tb1rl
@fargatepb-tb1rl 7 ай бұрын
@@francescociulla I had to change the port in docker compose, i don't know why with "5432:5432" does not work ports: - "5433:5432" (that's how it works) thankU, nice tutorial
@francescociulla
@francescociulla 7 ай бұрын
@fargatepb-tb1rl maybe you already have a running instance of postgres running on that port
JavaScript CRUD Rest API: Nodejs, Express, Postgres, Sequelize, Docker
27:33
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Containerizing a simple Python Flask app using Docker
13:59
Build your first REST API with Flask and PostgreSQL
27:42
teclado
Рет қаралды 72 М.
Async Transform Streams - Part 1 - Sane C++ Libraries [ep.32]
1:07:20
Stefano Cristiano
Рет қаралды 57
Simple REST API with Flask
53:21
Dennis Ivy
Рет қаралды 16 М.
Next.js 14, Rust, Docker: Build a fullstack rest API in typeScript and Rust
49:34
Docker Compose Tutorial
33:02
Programming with Mosh
Рет қаралды 467 М.
Techncial Tour - Algorand Staking
28:22
CompX
Рет қаралды 90
Python Full Stack App: Next.js 14, Flask, PostgreSQL, Docker
1:07:39
Francesco Ciulla
Рет қаралды 14 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19