Flask Full Series - Web Application Development with Python - Models and Databases - Episode 5

preview_player
Показать описание
Flask Python
#Flask #Python #FlaskTutorial

👍Welcome to my Python Flask tutorial

In this episode, we will learn how to connect our Web Application to a database, this will allow us to have maintainable information, that is going to be fun and comfortable to manage.

Throughout this series, I am going to go deeper into each topic by developing a real website that simulates an open market that different users can purchase items, including a budget system for each user.

Connect with me with:

👍 Subscribe for more Python tutorials like this:
🔥 Comment below on other topics you want to see tutorials next on my Channel.
-----------------------------------------------

My website:

Useful Links:

Code from Github:

Link to Download SQLite Viewer:

Timeline for the video:
00:00 - 03:00 - What are Databases & SQlite Database
03:00 - 05:25 - Installing SQLAlchemy
05:25 - 12:47 - Models & Creating our first Model
12:48 - 15:29 - DB Configurations
15:30 - 21:50 - Create DB file / Store Items in our DB
21:51 - 23:49 - Overiding __repr__ to display prettier objects
23:50 - 28:17 - Useful Flask commands with Python Shell
28:18 - 31:20 - DB Viewer in Graphical User Interface
Рекомендации по теме
Комментарии
Автор

Hi all, here we have one of the most exciting episodes you could watch in web development at all,
because we are going to learn how to connect our Website to a Database.
This is going to allow us to have an organized data that our Website could rely on.
I hope you'll enjoy it. Let me know how you felt about this episode :)

jimshapedcoding
Автор

Hey, I get the following error. Unresolved attribute reference 'Column' for class 'SQLAlchemy'. Pls help me out

thareeshprabakaran
Автор

I think the solution to runtime error encountered is to try the db commands in "flask shell" instead of "python".

burgundyhome
Автор

I get error on items = Item.query.all() help please

salvoscandura
Автор

Superb Jim
Am still waiting for ur reply on Instagram...

bahdev
Автор

הי כל הכבוד, אבל למה אין כתוביות? אשמח אם תוסיף אפשרות תרגום תודה

davidsperber
Автор

from market import db
FSADeprecationWarning: adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\name\FlaskMarket\market.py", line 7, in <module>
class Item(db.Model):
File "C:\Users\name\FlaskMarket\market.py", line 9, in Item
id = db.Column(db.Integer(), primary_key=True)
TypeError: Column() got an unexpected keyword argument 'primary_key'

help im getting this error

edmund
Автор

Hi Sir, I am having an error while running db.create_all() from the terminal, I tried to find the solution, but couldn't figure it out.

Error: 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().

MKSundaram
Автор

if anybody know please let me know

what is the different between:

db.session.query(User)

and

User.query.all()

? :)

sarkaran
Автор

my code is not working like nothing is happening when i put from market import db on the terminal ive been stuck there for like 2 days now idk maybe because the video is old same happened when i wwas building a project with your old video i put in the same code but then nothing happened idk y

Zannepah
Автор

Why you prefer not to do this project in virtual environment...
As it would have best options...

anup
Автор

I installed package flask_sqlalchemy but i can not import it in market.py file
AttributeError: 'SQLAlchemy' object has no attribute 'model' is getting dont know what that error

giridharreddyv
Автор

i am getting error as no such column exists (operational error)

sree-yi
Автор

hi jim
I installed package flask_sqlalchemy but i can not import it in market.py file

giridharreddyv
Автор

I installed package flask_sqlalchemy but i can not import it in market.py file

marmar
Автор

Thank you for all your efforts in this project. I have a basic -maybe stupid- question (as I'm still a newbie). When we start the complete project on a web server, how a new registered user can import new items he wants to sell in the 'market'. I'm not asking for pre-owned items but for new items he wants to sell in the market.

vkakouras
Автор

hello thanks for the explanation, though i keep getting this error : <<Mapper mapped class Item->item could not assemble any primary key columns for mapped table 'item' >>
how to fix it ?

fzohra
Автор

Hello Jim,

I get his message when I type 'from market import db'

from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'


I checked the modules and where there are installed and it seems to me okay. Any thoughts?

timurguner
welcome to shbcf.ru