Python Flask Tutorial: Full-Featured Web App Part 4 - Database with Flask-SQLAlchemy

preview_player
Показать описание
In this Python Flask Tutorial, we will be learning how to create a database using Flask-SQLAlchemy. SQLAlchemy is a great tool for working with databases because it allows us to interact with the database in an Object-Oriented manner, which is very intuitive once we get used to it. We will be using a SQLite database to get us started and then move on to a Postgres database when we deploy the application. Let's get started...

The code for this series can be found at:

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Python #Flask
Рекомендации по теме
Комментарии
Автор

Hey All: As of version SQLAlchemy 3.0 to create your db file you will need to run some commands like this in the shell :
from project import app, db
app.app_context().push()
db.create_all()

Then the .db file is created in a folder called "Instance" in your project.

Hope this helps some one

danielwarzecha
Автор

For anyone who is facing the error of 'outside application context', try this :
- in your terminal: from <your_app> import app, db
- with app.app_context():
db.create_all()

Note: You can use this also when you will want to add data to the database. GoodLuck!

othmanethebold
Автор

Corey Schafer is teaching us things which we did not learn in universities. I promise I will support you through Patreon once I land a job.

soumyajitdey
Автор

17:04 made me so happy when you noticed that and fixed it. I had a solid 10 minutes of anxiety.

CainanParker
Автор

Behind the smooth voice is tons of debugging and eternities of reading the docs

meenamotiramani
Автор

Hey Corey, you literally helped me Land a dream job . Thank you for all you've contributed.

padraic
Автор

In my university I'm attending a course of Information System in which the professor is using exactly your code in the labs lessons without mentioning you. I found you by looking for help on youtube.

giuseppetemisio
Автор

Your videos are really great! Every second of this video is understandable, that really takes talent! Keep it up!

sirnakerb
Автор

Dude, I am loving this series of videos, but MAN that was a challenging 29:57 minutes! Thank you thank you thank you for making this video

ArchAid
Автор

When I'm no longer a broke college student I'll be joining your Patreon!!

mckadesorensen
Автор

As someone who wrote PHP 20 years ago, damn do I wish this existed then haha This is awesome. Thanks for your incredibly clear and concise videos

fouroakfarm
Автор

One of the clearest, most understandable and easy to follow instructional videos on the topic. Much much better than 99.9% (OK, I could have written 100%....) of what I have seen around.

tubalix
Автор

Ive been playing with laravel for several months, but after seeing how clean and simple flask is, I'm probably going to jump onto python. Thank you for this amazing reference

mahtoosacks
Автор

This may be the best crash course on sqlalchemy. Love the series.

treelight
Автор

From watching your videos and reading these comments, I no longer regret not studying a computer science degree at university :)

TRasheed
Автор

the best flask tutorial series hands down. i don't even mind the ads and i've had monstrous urges to break screens over them.

brentelisens
Автор

While True:
Print("Thank You So Much")

stormerthend
Автор

bro. genius, love the way you teach.
on vacation actually, pumped to learn here at a cafe in the middle of patagonia. keep it up

tomasemilio
Автор

Exceptional video. Your examples are on point and flow very well. I find you explanations clear and very concise. They explain everything I need to know with out rambling. Any questions that came to my mind were answered in the video. (Get out of my mind you freaking mind reader! Ha ha) All technical videos should take a note from how this was made. Well done, and thank you. I'm sure a lot of hard work and forethought went into this.

mjju
Автор

If db.create_all() is not creating the file for you, check that you wrote URI and not URL in = 'sqlite:///site.db'".

Don't be me xD

Following this tutorial in WLS2 but in my Windows 10's VS Code accessing Ubuntu remotely. Working perfectly so far.



Amazing tutorial so far!

Manuel-rlum