Python Flask Beginner Tutorial - Todo App - Crash Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024

ความคิดเห็น • 116

  • @popcycleism
    @popcycleism 2 ปีที่แล้ว +2

    This was very satisfying. The topping was your introduction to Semantic UI giving more possibilities from using bootstrap. Now to learn how to upload photos! Thank you for this tutorial.

  • @newsjuice7404
    @newsjuice7404 2 ปีที่แล้ว +4

    It was awesome thanks a lot just a little input in for loop if you replace{{ todo.id }}with {{loop.index}} it ll automatically update the indices if you delete any in the middle or top

  • @joeygaller8761
    @joeygaller8761 ปีที่แล้ว +2

    GOOD DAY SIR
    I MAY BE HAVING A PROBLEM ON THE DB_SQLITE TABLE
    I WONT AUTOMATICALLY CREATE ANOTHER FOLDER
    I FOLLOW ALL YOUR INSTRUCTIONS BUT IT WONT JUST CREATE ANOTHER FOLDER AND JUST HAVE AN ERROR

  • @syedmuhammadraza9534
    @syedmuhammadraza9534 3 ปีที่แล้ว +2

    Just completed this TODO-APP really helpful appreciated!

  • @goodgrow_io
    @goodgrow_io 4 ปีที่แล้ว +4

    This video is amazing. Best guide I've seen so far.

    • @patloeber
      @patloeber  3 ปีที่แล้ว

      Glad you like it :)

  • @TheAmazinRaven
    @TheAmazinRaven ปีที่แล้ว +14

    To anyone having issues w the SQLAlchemy thingy or the app not running properly add this below your todo class (under it, not in it):
    with app.app_context():
    db.create_all()
    A really kind stranger in a Discord helped me solve this & I wanted to pay it forward. :)

    • @ataberkpektas8784
      @ataberkpektas8784 ปีที่แล้ว

      sir i didnt understand you. where will i write this?

    • @stephontidd7051
      @stephontidd7051 10 หลายเดือนก่อน

      Thanks, this solution still works.

  • @papasmoke3311
    @papasmoke3311 2 ปีที่แล้ว +5

    One thing i don’t understand is: why does he create a new database every time the program gets run. wouldn’t it be better to check if a db exists?

  • @mctosima
    @mctosima ปีที่แล้ว +2

    As of Flask-SQLAlchemy 3.0, all access to db.engine (and db.session) requires an active Flask application context. db.create_all uses db.engine, so it requires an app context.

    • @ashiwal9910
      @ashiwal9910 ปีที่แล้ว

      I am stuck there can u pls guide me?

    • @gokulkrishnan4721
      @gokulkrishnan4721 ปีที่แล้ว +1

      @@ashiwal9910 Just above db=SQLAlchmey (app)
      add this line: with app.app_context():
      -> By doing this you will get instance folder 📁 in that you can see .db file
      -> If you don't want to do this just use SQLAlchmey version 2.5.1 (pip install flask-SQLAlchemy==2.5.1) you can easily push data from the python shell
      (ex: >>> from app import db
      >>> db.create_all()
      )
      I hope this helps you :(

    • @princeakpolo1074
      @princeakpolo1074 ปีที่แล้ว +3

      just above -> app = Flask(__name__)
      add this line below it: app.app_context().push()

  • @sphinxz_gaming
    @sphinxz_gaming 2 ปีที่แล้ว +1

    I love the Semantixc UI! It is very easy to style the page! And I liked your video as well and subscribed! Amazing content! Keep it up the good videos! It helps on my programming ❤️🙏

  • @KeyserTheRedBeard
    @KeyserTheRedBeard 2 ปีที่แล้ว +1

    impressive upload Python Engineer. I killed that thumbs up on your video. Continue to keep up the exceptional work.

  • @LearnBr0
    @LearnBr0 8 หลายเดือนก่อน

    Thanks Patrick! I'm starting with Python and found your tutorial quite useful. Keep up the good content 👏

  • @bryanchambers1964
    @bryanchambers1964 2 ปีที่แล้ว +2

    I'm very confused right from the start (1:45). Where are you entering:
    git mkdir flask-todo
    I think its just in your terminal right? I did this in my terminal and it says 'mkdir is not a command'. I installed 'git' too so I don't understand this. If take out 'git' and just enter 'mkdir flask-todo' it works but my "Hello World" website doesn't work in the following steps.

  • @wamiqmushtaq2825
    @wamiqmushtaq2825 7 หลายเดือนก่อน

    Patrick would love u to do a separate tutorial on using flask sql alchemy, it is much needed!!

  • @crazyGodLikE
    @crazyGodLikE 3 ปีที่แล้ว +1

    I like your pace and you explain concepts well. Thank you.

    • @patloeber
      @patloeber  3 ปีที่แล้ว

      Glad it was helpful!

  • @rishabkumar9578
    @rishabkumar9578 4 ปีที่แล้ว +1

    You are a Gem in a bag of rocks Mr.Python !!!

    • @patloeber
      @patloeber  4 ปีที่แล้ว

      Thanks a lot!

  • @swoopsavvy7560
    @swoopsavvy7560 วันที่ผ่านมา

    @TheAmazinRaven, Really great, you solved it!!!!

  • @I_am_pradeep
    @I_am_pradeep 4 ปีที่แล้ว +3

    Great tutorial. Very Helpful. Thank You So Much!

  • @kshitijgupta6175
    @kshitijgupta6175 3 ปีที่แล้ว +2

    In my system, VSCode doesn't show it just shows [] this. Any suggestions how to tackle this problem?

  • @adaum79
    @adaum79 2 ปีที่แล้ว

    Perfect! Simple and clear, like always.

  • @SA-oj3bo
    @SA-oj3bo 3 ปีที่แล้ว +1

    Thanks, but how to deploy to a cloud server?

  • @hakusho04
    @hakusho04 3 ปีที่แล้ว

    exactly what i need to start my flask journey thanks

  • @gillarajieprasatya812
    @gillarajieprasatya812 2 ปีที่แล้ว

    i dont know why, but i now im falling in love with flask

  • @mohammedchoupaqee5530
    @mohammedchoupaqee5530 ปีที่แล้ว

    It is an excellent course tutorial with professional Engine Good Luck ,

  • @aidangasim
    @aidangasim 4 ปีที่แล้ว +1

    its amazing,useful concise and clear,i am eternally thankful ))

    • @patloeber
      @patloeber  4 ปีที่แล้ว

      Thank you! Glad you like it :)

  • @crystal-arts-1
    @crystal-arts-1 2 ปีที่แล้ว

    Thank you for the awesome tutorial!

  • @itsblueworld3591
    @itsblueworld3591 2 ปีที่แล้ว

    A very well explained tutorial, totally understandable..

  • @malcolmrichardson
    @malcolmrichardson 2 ปีที่แล้ว

    Thank you! Great tutorial!

  • @ombrebyaarti3024
    @ombrebyaarti3024 2 ปีที่แล้ว

    Thanks for sharing…it help to improve.

  • @liker2356
    @liker2356 2 ปีที่แล้ว

    Amazing video helped a lot!!

  • @junivensaavedra882
    @junivensaavedra882 2 ปีที่แล้ว

    Excellent content. Thank you very much. :D

  • @alexandergdansk
    @alexandergdansk 2 ปีที่แล้ว

    Super!
    Thanx for it!

  • @creyssu
    @creyssu 3 ปีที่แล้ว

    Bro you help me a lot with the flaskAlchemy, thank you !

    • @patloeber
      @patloeber  3 ปีที่แล้ว

      Happy to help

  • @muhammadzubairbaloch3224
    @muhammadzubairbaloch3224 4 ปีที่แล้ว

    dil khush kar detay ho bhai. really nice work.

  • @ammarsajjid8258
    @ammarsajjid8258 2 ปีที่แล้ว

    Thank You for the video.

  • @PythonDevelopment
    @PythonDevelopment 2 ปีที่แล้ว

    This greate content! Awesome

  • @cngetich37
    @cngetich37 2 ปีที่แล้ว

    Great Tutorial

  • @mateen161
    @mateen161 4 ปีที่แล้ว

    Very helpful content. Thank you!

    • @patloeber
      @patloeber  4 ปีที่แล้ว

      Glad you like it :)

  • @aryakrishna4932
    @aryakrishna4932 3 ปีที่แล้ว

    awesome tutorial ! thanks for this!

    • @patloeber
      @patloeber  3 ปีที่แล้ว +1

      thanks for watching!

  • @dhineshbabu9376
    @dhineshbabu9376 4 ปีที่แล้ว

    Awesome Tutorials.. Simple and Neat .. :)

  • @ssk-ct7cr
    @ssk-ct7cr ปีที่แล้ว

    Very good tutorial! I wish to add the functionality of deleting all the items at once by the click of a button ('Clear todos', for example). Does someone know how I could do this?

  • @jbruce87
    @jbruce87 ปีที่แล้ว +1

    Not getting "db.sqlite" to create. I will post my code below. working on a Mac like the video. even tried adding the "with app.app_context():" that other commenters have suggested. no luck

    • @jbruce87
      @jbruce87 ปีที่แล้ว

      from flask import Flask, render_template
      from flask_sqlalchemy import SQLAlchemy
      app = Flask(__name__)
      app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite'
      app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
      db = SQLAlchemy(app)
      @app.route('/')
      def index():
      # show all todos
      return render_template('base.html')
      if __name__== "__main__":
      with app.app_context():
      db.create_all()

      app.run(debug=True)

    • @jbruce87
      @jbruce87 ปีที่แล้ว

      Now im getting this error:
      Traceback (most recent call last):
      File "/Users/jb/Desktop/PyFlaskAppThing/app.py", line 9, in
      class Todo(db.model):
      File "/Users/jb/Desktop/PyFlaskAppThing/venv/lib/python3.9/site-packages/flask_sqlalchemy/extension.py", line 988, in __getattr__
      raise AttributeError(name)
      AttributeError: model

    • @iamdavidmohan
      @iamdavidmohan ปีที่แล้ว +1

      @@jbruce87
      Had the same problem.
      Clear the Flask package and the Flask-SQLAlchemy package --> I just cleared everything in the [environment]\Lib Folder which I installed since I started the tutorial
      Then Install
      pip install Flask==2.1.0
      pip install -Iv Flask-SQLAlchemy==2.5.1
      Using this Versions the DB was created

  • @harryayce11
    @harryayce11 2 ปีที่แล้ว

    What about implementing "create","delete" etc in an async manner?

  • @bryanchambers1964
    @bryanchambers1964 2 ปีที่แล้ว

    Could you mind please explain why you Visual Studio instead of say Jupyter. I tried following this in a Jupyter notebook but the program crashed and couldn't create a web page. It would have been helpful if you gave a little explanation about why you are using Visual Studio and whether it must be done exactly like that. I did everything the same way in visual studio and got the same error again.

  • @sakshisaxena8913
    @sakshisaxena8913 3 ปีที่แล้ว +1

    any tutorial on flask with Postgres sir?

    • @novaria
      @novaria 3 ปีที่แล้ว

      SQLalchemy allows you to simply connect to a postgreSQL database AFAIK.

  • @prajwalm.s7976
    @prajwalm.s7976 11 หลายเดือนก่อน

    At 14:32 I am getting this error - File "F:\flask-todo\venv\lib\site-packages\werkzeug\local.py", line 508, in _get_current_object
    raise RuntimeError(unbound_message) from None
    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.

    • @shobbyduncan1607
      @shobbyduncan1607 4 หลายเดือนก่อน

      did yyou manage?....i still have the same error

  • @OmaimaHasan
    @OmaimaHasan 10 หลายเดือนก่อน

    Hey, i was following along up until adding a database. SQLAlchemy was installed but now its not working when i run the app.py file

    • @OmaimaHasan
      @OmaimaHasan 10 หลายเดือนก่อน

      its saying that RuntimeError: Working outside of application context.

  • @ashishbhardwaj8609
    @ashishbhardwaj8609 ปีที่แล้ว +1

    Hello Sir. Great tutorial, especially for a beginner. I created the app following the tutorial, but, when I tried deploying it using Vercel, it showed "500 Internal Server Error". However, it works perfectly fine when I tested it using the terminal on my local server... Please provide guidance

    • @kushlawatidevi1101
      @kushlawatidevi1101 11 หลายเดือนก่อน

      try using wsgi as output gateway

  • @gowthambhat1498
    @gowthambhat1498 2 ปีที่แล้ว

    great tutorial

  • @eccomi21
    @eccomi21 3 ปีที่แล้ว +1

    Thanks for the tutorial!
    However im running into a slight issue.
    Im using pycharm as my IDE. i was not able to install FlaskSQLAlchemy the normal way. it would throw an error. So i had to resort to using the command
    "python -m easy_install SQLAlchemy"
    So i managed to install it with that command, but now despite it being in the right venv, showing in the list and all when trying to import it it throws the following error:
    "No module named 'flask_sqlalchemy'"
    Even after googling, all the answers i found that matched my IDE and OS (being win10) i still cant figure out what the problem is.
    Do you have any idea what the problem could be?

    • @eccomi21
      @eccomi21 3 ปีที่แล้ว

      solved my own question. make sure to follow his tutorial letter by letter. theres two different flask sql alchemy packages.

  • @akashpardeshi5721
    @akashpardeshi5721 2 ปีที่แล้ว

    I'm stuck on one error Windows is not support crypt any Idea how to solve it? I'm using VS Code and Windows 10

  • @abdullah-sx2qf
    @abdullah-sx2qf 2 ปีที่แล้ว

    Hey, how would I make it so each user that logins in has their own task app?

  • @THOMASKUTTYREJI
    @THOMASKUTTYREJI 3 ปีที่แล้ว

    thank you so much .... an amazing video...

    • @patloeber
      @patloeber  3 ปีที่แล้ว

      glad you like it!

  • @himanshushukla787
    @himanshushukla787 3 ปีที่แล้ว

    Hey man nice tutorial. I made the app by following the tutorial
    but in my app the title of the todo always says title instead of the title that I put in to the text box and I can't figure out what is wrong.

  • @rachit6099
    @rachit6099 4 ปีที่แล้ว

    Thankyou for this video just wanted to know which theme are you using for visual studio code

    • @patloeber
      @patloeber  4 ปีที่แล้ว

      Have a look at my newest video :) There I show my VS Code setup. It's the night owl theme

  • @shreyashimukhopadhyay6354
    @shreyashimukhopadhyay6354 4 ปีที่แล้ว

    Could you please also show how to build Machine learning Apps using flask..

    • @patloeber
      @patloeber  4 ปีที่แล้ว +2

      Yes, I do have one more with pytorch and flask right now...

  • @I_am_pradeep
    @I_am_pradeep 4 ปีที่แล้ว

    can you please tell me how to validate form in this ?

  • @emmachuksudeji9477
    @emmachuksudeji9477 2 ปีที่แล้ว

    thanks again

  • @TheFuentes5551
    @TheFuentes5551 4 ปีที่แล้ว

    I do have to ask a question. What is better to learn Flask or Django? Expecialy for begginer

    • @patloeber
      @patloeber  4 ปีที่แล้ว +3

      It depends on what you want to do. Both are great frameworks. Flask is more lightweight and easier for beginners. However, if you want an app with user management/authentication, then I would go with Django since it takes care of a lot of things for you.

    • @TheFuentes5551
      @TheFuentes5551 4 ปีที่แล้ว

      @@patloeber the only reason I ask is because I saw online many advice Django because its easy and very powerful. And as you said Django does does a lot of things for you.
      So now as a noob i dont know on which to focus on? Or maybe I should learn both?
      I did saw all your videos and they did help me a lot by the way. I have good understandings of "intermediate" Python skills

  • @efeakaroz6686
    @efeakaroz6686 4 ปีที่แล้ว

    I love your vid. Also what is your vscode theme

    • @patloeber
      @patloeber  4 ปีที่แล้ว

      Thanks! It's the night owl theme...

  • @anithapoly6849
    @anithapoly6849 2 ปีที่แล้ว

    How can this be done in sqlite3 database in pycharm

  • @Stone8age
    @Stone8age 4 ปีที่แล้ว

    Nice job dude, any plans for a django one?

    • @patloeber
      @patloeber  4 ปีที่แล้ว +2

      Django crash course is on my list too :)

  • @shri1345
    @shri1345 3 ปีที่แล้ว

    Hey,I have a quite of an issue on kali linux saying that, directory not found when I try to use /venv/bin/activate

    • @patloeber
      @patloeber  3 ปีที่แล้ว

      maybe on linux the command is slightly different than on Mac

    • @shri1345
      @shri1345 3 ปีที่แล้ว

      No actually I found out that the files were hidden
      .But now it works ;)

  • @sendyourbae
    @sendyourbae 3 ปีที่แล้ว

    hi. i have some problems with this tutorial. i want to add another field called name, so this todo apps have todo field and name field for someone who writes it. how can i insert the name into the app.py and display it? i will wait for your reply. thank you

    • @patloeber
      @patloeber  3 ปีที่แล้ว

      the same way I integrated the "title"

  • @bryanchambers1964
    @bryanchambers1964 2 ปีที่แล้ว

    Why whenever I try to learn stuff like this all I ever get are error messages and I never get the correct result even if I copy everything exact?

    • @ssk-ct7cr
      @ssk-ct7cr ปีที่แล้ว

      Don't know which error you're having... I got an error related to context. With a slight code modification I got the result expected. I'm sending the code, in case you got the same error:
      Right at the end of the app.py file:
      if __name__ == '__main__':
      with app.app_context():
      db.create_all()
      app.run(debug=True)
      Hope it helps!

    • @bryanchambers1964
      @bryanchambers1964 ปีที่แล้ว +1

      @@ssk-ct7cr Thanks, I'll try that when I get a chance and let you know if it worked.

    • @ssk-ct7cr
      @ssk-ct7cr ปีที่แล้ว

      @@bryanchambers1964 Great! ;)

  • @playgoods
    @playgoods 4 ปีที่แล้ว

    amazing

  • @railotrailot521
    @railotrailot521 4 ปีที่แล้ว +1

    Hi, where are u from ? interesting accent)))thanks a lot for good content!

    • @patloeber
      @patloeber  4 ปีที่แล้ว

      Germany ;)

    • @sife-i9n
      @sife-i9n 3 ปีที่แล้ว

      @@patloeber gut ;)

  • @sawaito
    @sawaito ปีที่แล้ว

    Lol, flask is a lot easier than django. I don't know why i'm learning django and not flask 🤨

  • @tamtonaquib
    @tamtonaquib 2 ปีที่แล้ว

    Lol tf was that voice

  • @princysingh1398
    @princysingh1398 ปีที่แล้ว

    Get this error while activate env...someone help me out
    error:-
    PS C:\Users\THIS\Pictures\flask-todo> \Python27\Scripts\virtualenv.exe venv
    \Python27\Scripts\virtualenv.exe : The term '\Python27\Scripts\virtualenv.exe' is not recognized as the
    name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
    path was included, verify that the path is correct and try again.
    At line:1 char:1
    + \Python27\Scripts\virtualenv.exe venv
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (\Python27\Scripts\virtualenv.exe:String) [], CommandNotF
    oundException
    + FullyQualifiedErrorId : CommandNotFoundException

  • @yusufsAnt31
    @yusufsAnt31 2 ปีที่แล้ว

    Great tutorial

  • @pavelow36
    @pavelow36 3 ปีที่แล้ว

    amazing

  • @shreyashimukhopadhyay6354
    @shreyashimukhopadhyay6354 4 ปีที่แล้ว +1

    Amazing tutorial! Thanks a lot!