Databases & SQLAlchemy - Flask Tutorial Series #7

  Рет қаралды 18,113

NeuralNine

NeuralNine

Күн бұрын

Пікірлер: 26
@wonkywombat
@wonkywombat 8 ай бұрын
Great episode. I too will need to redo this with an existing MySQL db.
@pawjast
@pawjast Ай бұрын
In 12:49 you run `flask db init`. It works but is a bit confusing (unless it's explained further in the video). How does Flask know where to look for a `db` to initiate? I think it only works because we defined our app inside `app.py` which is sort of a convention so this is a default place for an app to be in. So Flask checks `app.py` by default - finds the `db` in it and all is good. But if you change the name to anything, e.g. `my_app.py` - then the `flask db init` throws an error ("Error: Could not locate a Flask application.") So first you need to tell Flask where your actual `app` and `db` is by setting `FLASK_APP` variable or calling `flask --app my_app:app` where: - `my_app` is the name of the file you're app is in (so `my_app.py`) - `app` is the name of the variable the Flask app was assigned to inside that file (in the tutorial we actually use `flask_app` inside `run.py`)
@cvicvicvi
@cvicvicvi 8 ай бұрын
Hey, thank you so much for this tutorial series, it's very well thought and easy to understand for beginners like me. Currently trying to develop my first web app, that's exactly what I needed.
@jayewastaken9486
@jayewastaken9486 8 ай бұрын
I love this series!
@samannwaysil4412
@samannwaysil4412 6 ай бұрын
Keep these tutorials coming brother!
@FrozenShield
@FrozenShield 8 ай бұрын
Thanks for the tutorial, it helped me understand flask-sqlalchmey! I am trying to understand at 15:10 you mentioned that it loops from the other python files. Is it necessary to loop it like that? I also looked at the quick start instructions for flask-sqlalchemy and it looks like you can do it all in app.py. When you write flask run in the terminal it looks for app.py to run that so is it best practice to keep everything in app.py or split it out like how you did it?
@frontetatico
@frontetatico 6 ай бұрын
Hi, I think it's a better practice to split
@kylec.5476
@kylec.5476 7 ай бұрын
Great series!
@johnraz99
@johnraz99 8 ай бұрын
Thank You. I just need to get it to work with my MySQL database now!
@johnraz99
@johnraz99 8 ай бұрын
Got it working with MySQL. Just had to change SQLALCHEMY_DATABASE_URI prefix to 'mysql+mysqlconnector://'. I also installed mysql-connector-python
@leonardomoreiralouzas3995
@leonardomoreiralouzas3995 4 ай бұрын
Relly good! I changed the detail and delete to a single view to make it less code, I think it looks better that way. All the code is in my github repo
@eklownr4566
@eklownr4566 8 ай бұрын
Nice tutorial.
@aafan.kuware
@aafan.kuware 8 ай бұрын
27:56 was not htmx will be the best choice to do this crud operations instead of writing these long JS? if possible, please make one separate video and all futher operation with HTMX.
@gerlannoharrisson9210
@gerlannoharrisson9210 3 ай бұрын
top! thank you bro!
@michaelrobson3092
@michaelrobson3092 7 ай бұрын
Awesome , could you show how we could use a DB like Redis with SQLite & SQLAlchemy
@mhmmdalfatehhishahmuddin2670
@mhmmdalfatehhishahmuddin2670 6 ай бұрын
My problem is when migrating SQL when I run the command: flask db init it say 'Could not import 'db'. How to fix it?
@dishuu2714
@dishuu2714 4 ай бұрын
same
@DavidVeraAlvarez
@DavidVeraAlvarez 3 ай бұрын
@@dishuu2714 1. Make a clean vevn 2. install flask, flask-sqlalchemy, flask-migrate 3. run the flask db commands (it should work now) 4. make sure you have sqlite3 installed 5. pay attention to pycharm advices to install sqlite3 related content if it's the first time you are using sqlite3 6. Add a new sqlite3 data source clicking the plus icon in the database window that you can access in at the right of your screen inside pycharm 7. Set the sample database 'testdb.db' in the file field browsing your directories 8. Test Connection That worked for me.
@RocketLR
@RocketLR 8 ай бұрын
my problem is with the db.Model classes is that the __init__ does not do anything when creating a object from those classes.. So i have to make classes that inherit from Base. But then they dont get created as far as i can tell.. As im writing this, im wodnering if should create a db.Model table then another class that inherins from that class that inherited from db.Model..
@spaff_hazz
@spaff_hazz 2 ай бұрын
after sending a post request, if i reload the page, i get the form resubmission alert and if i continue it takes the data that i last filled the form with even though it's not in the input field. how do i prevent this?
@mugomuiruri2313
@mugomuiruri2313 4 ай бұрын
good see u again
@saulvera5469
@saulvera5469 5 ай бұрын
dont know why but when I try to migrate it doesn't add any table, I ended up creating it in SQL
@spacecoder0526
@spacecoder0526 4 ай бұрын
I have same issue.
@masoooomx
@masoooomx 6 ай бұрын
which OS and which IDE ????
@bengaltiger8401
@bengaltiger8401 5 ай бұрын
Popos with pycharm professional edition
@masteradvisor594
@masteradvisor594 2 ай бұрын
15:40
User Authentication - Flask Tutorial Series #8
28:14
NeuralNine
Рет қаралды 11 М.
SQLAlchemy Turns Python Objects Into Database Entries
22:23
NeuralNine
Рет қаралды 183 М.
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 12 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 21 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 16 МЛН
SQLModel + FastAPI: Say Goodbye to Repetitive Database Code
19:50
SQLAlchemy Makes Using Python Databases EASY
19:08
Eric Roby
Рет қаралды 5 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 100 МЛН
Flask Tutorial #7 - Using SQLAlchemy Database
14:17
Tech With Tim
Рет қаралды 243 М.
Using Databases With Flask - Python and Flask #8
24:16
Codemy.com
Рет қаралды 77 М.
FastAPI & Alembic - Database Migrations in FastAPI apps
18:33
Learn Database Normalization - 1NF, 2NF, 3NF, 4NF, 5NF
28:34
Decomplexify
Рет қаралды 2,1 МЛН
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 12 МЛН