Python Website Full Tutorial - Flask, Authentication, Databases & More

Поделиться
HTML-код
  • Опубликовано: 24 сен 2024

Комментарии • 2,5 тыс.

  • @TechWithTim
    @TechWithTim  Год назад +56

    Start a high paying tech career making $60k+/year with NO DEBT: coursecareers.com/a/techwithtim?course=software-dev-fundamentals

  • @iamnexom
    @iamnexom 2 года назад +132

    I wasted thousands of dollars in college and learned nothing compared to what i learned here in this channel for free. You guys are amazing . You people deserve a noble prize for what you are doing here.

    • @barmalini
      @barmalini 5 месяцев назад +12

      well, you could also learn something while in college, and not waste that much money

    • @OikPoinFive
      @OikPoinFive 3 месяца назад +2

      @@barmalini yeah so true

    • @OikPoinFive
      @OikPoinFive 3 месяца назад +3

      u didnt listen there then. ya hear? just kidding....

  • @siddheshkhadapkar3071
    @siddheshkhadapkar3071 Месяц назад +16

    For those how come to the comment session with create_all() to create database error 1:33:45.
    As per the new version, this is the fix:
    def create_database(app):
    if not path.exists('website/'+ DB_NAME):
    with app.app_context():
    db.create_all()
    print("Created Database!")
    Thanks for the video. @TechWithTim

    • @azolamlotywa929
      @azolamlotywa929 17 дней назад

      still it gives me this error message (ImportError: cannot import name '_app_ctx_stack' from 'flask' ) @siddheshkhadapkar3071

  • @oldmankatan7383
    @oldmankatan7383 3 года назад +414

    Please, don't apologize for a long video when it is fast paced and full of good stuff like this!
    Flask can be a little inscrutable sometimes, and I really appreciate that this tutorial went from zero to functional in one go. Bravo!

    • @SphinxzOfficialYT
      @SphinxzOfficialYT 2 года назад +2

      lol

    • @nicoleervas4759
      @nicoleervas4759 2 года назад +3

      So true like Tim istg why are you apologizing?😭😭 Ur the one giving us gr8 content the longer just means you did more effort explaining it which we love obviously 😭

    • @chillydoog
      @chillydoog 2 года назад

      I cant HEAR yOU>>!! OH...HELL>>>>YEAHHH

    • @preattogaming1533
      @preattogaming1533 Год назад

      Bro can u help me out it's showing import error

    • @oldmankatan7383
      @oldmankatan7383 Год назад

      @@preattogaming1533 I'd have to see the error, but import errors are usually because you haven't installed the module you are trying to import. "Pip install" the module first!

  • @Nolusindiso_Hleko
    @Nolusindiso_Hleko 2 года назад +11

    Been stressing over a uni project for the past two months and came across this video, I literally want to cry. Thank you soooooooooooooo much!

  • @anshchaurasia8460
    @anshchaurasia8460 Год назад +15

    I won't lie, this is the most worth video on RUclips that I have ever seen in my entire lifetime! Your videos are the best, without doubt. Thank you for helping everyone by making everything simpler than all the other teachers on RUclips.

  • @sighera
    @sighera 3 года назад +827

    Tim... We can't thank you enough for this tutorial! I can't put it in words how much this tutorial helped me to finally start progressing with Python programming! I know, for you this is simple, however, for beginners like me, this tutorial is like finding a bag of gold. Thank you!

    • @armygstan9541
      @armygstan9541 3 года назад +4

      Hey bro can you tell me one thing, what's back-end and front-end Language in this project.
      Please answer me🥺

    • @asadraza6146
      @asadraza6146 2 года назад +3

      Speak for yourself

    • @ButterCupLetsgoColts
      @ButterCupLetsgoColts 2 года назад

      @@asadraza6146 no no no no noi!!!!

    • @issam_allali
      @issam_allali 2 года назад

      How to connect with sql server

    • @stealth2338
      @stealth2338 2 года назад +1

      @@armygstan9541 did you find the answer to your question bro?

  • @stevemorse5052
    @stevemorse5052 2 года назад +120

    To those of you that have just landed on this video.
    This is one of the best videos I have ever watched.
    For me, it covered everything I wanted to learn in one simple to understand package.
    Thank you Tim.

    • @louisgalluzzo9284
      @louisgalluzzo9284 2 года назад +2

      im still not past the changing interpreters part. no matter which interpreter i choose i still keep getting the module error not found. i have been stuck on this for 4 days with no where to turn and no question being answered or any answer of help.

    • @LG-ut3hw
      @LG-ut3hw Год назад

      can u help me?
      Min 28:13 he said to copy the thing
      I didn't know from where bc my English isn't good can u help me?

    • @parthchavan68
      @parthchavan68 Год назад

      @@LG-ut3hw check the description for the code used in the tutorial

    • @prathamborghare229
      @prathamborghare229 Год назад

      @@louisgalluzzo9284 +1

    • @prathamborghare229
      @prathamborghare229 Год назад

      @@louisgalluzzo9284 Stuck on the same issue did you find a solution yet?

  • @kenmurphy4259
    @kenmurphy4259 2 года назад +121

    This young man is an incredible tutor. He explains the concepts so clearly. Top notch, thanks Tim!

    • @LotOFfactories
      @LotOFfactories Год назад

      "This young is incredible" "WOW" WHAT lS That?????Is(is) vs ls(Ls)

  • @cigomba
    @cigomba 2 года назад +4

    I don't understand why most youtubers seem to focus on front end. I think backend is so much more useful! Thanks for this Tim

  • @msrusu
    @msrusu Год назад +17

    You deserve a Nobel prize in virtual teaching, never seen a comprehensive guide as you done..easy to learn, explaining in detail... 🎉

    • @TechWithTim
      @TechWithTim  Год назад +5

      Wow, thank you!

    • @SmurphofChaos
      @SmurphofChaos 11 месяцев назад

      @@TechWithTim When I download VS 2022, it looks different and I can't make different folders within a project- what should I do?

    • @gerardonavarro3400
      @gerardonavarro3400 4 месяца назад

      ​@@SmurphofChaosdownload vs code not vs

    • @SmurphofChaos
      @SmurphofChaos 4 месяца назад

      @@gerardonavarro3400 tysm lol. Been stuck using Python IDLE this whole time lmao

  • @sena1663
    @sena1663 2 года назад +54

    I was doing a project and I was frustrated and scared because I was sure I could not do it. But following this tutorial gave me confidence and I finally did it! It was so helpful and easy to follow. Thank you so much Tim!!

  • @waffleman9178
    @waffleman9178 3 года назад +34

    I got to say that as a beginner with 3 days learning python, I can't understand most of the the code you did but you gave me courage to continue what I'm doing

    • @AhoyCapnLinux
      @AhoyCapnLinux 3 года назад +13

      Python, like all skills, takes a lot of time. Stick with it, and remember that no programmer knows it all. You can build some of the most complex systems on earth, but you'll still need Google from time to time. Good luck!

    • @waffleman9178
      @waffleman9178 3 года назад +1

      @@AhoyCapnLinux thanks for this reply, but as for now I was building a calculator with tkinter. And your reply thought me that it really takes more time and practice. I never knew that people like you have interest to help me. Thanks men

    • @justinwong833
      @justinwong833 3 года назад

      @@waffleman9178 It's going to be quite the journey moving ahead, be sure not to lose faith and remember to always have fun! Happy coding!

    • @waffleman9178
      @waffleman9178 3 года назад +2

      @@justinwong833 aww.. thanks. I'm so amazed people spend their time replying on this comment just to help me and others.

    • @justinwong833
      @justinwong833 3 года назад +1

      @@waffleman9178 I hope you'd pay it forward in the future by helping other newer coders! Happy to see a new member join our community

  • @ahmedyousif4782
    @ahmedyousif4782 3 года назад +1202

    No algoexpert, i don't what to become a software engineer at google.

  • @noobtester1933
    @noobtester1933 2 года назад +94

    1:33:40 in the video when he's having the import problem, I think what he meant to say or do was:
    from . import models
    because that's what I did, for everyone else using this blueprint to add more classes other than user and notes. Also if you're having the missing module SQL alchemy and/or flask login just go to your terminal and install both modules. I ran into those errors even though I installed flask it didn't come with everything so to make it clear in your terminal type:
    pip install -U Flask-Login
    and/or
    pip install Flask-SQL-Alchemy
    Then everything should work fine. Also to add on at the 1:54:39 section when you are in the __init__.py and you're doing the whole login_manager.user_loader part. If you used the from. import models to optimize your code, you'll get an error cause User isn't defined with the code written in the video. You have to tell the computer User is from the models module like this.
    @login_manager.user_loader
    def load_user(id):
    return models.User.query.get(int(id))
    not
    @login_manager.user_loader
    def load_user(id):
    return User.query.get(int(id))
    like in the video. Just so you know. Hope this helps someone.

    • @philosophe2517
      @philosophe2517 Год назад

      thanks

    • @philosophe2517
      @philosophe2517 Год назад +7

      db = SQLAlchemy()
      def create_app():
      app = Flask(__name__)
      app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///project.db"
      db.init_app(app)
      from . import models
      with app.app_context():
      db.create_all()
      return app
      # There is no need for that create_database function. SQLAlchemy will already not overwrite an existing file, and the only time the database wouldn't be created is if it raised an error.

    • @oh_Penitent_one
      @oh_Penitent_one Год назад

      @@philosophe2517 with that , return User.query.get(int(id)) won't work , the user won't be defined

    • @VaibhavKumarMishra-hr5uv
      @VaibhavKumarMishra-hr5uv Год назад

      This really helped me in both the timestamps you mentioned ! Thanks a lot !

    • @midasredblade236
      @midasredblade236 Год назад

      f

  • @AshutoshJatkar
    @AshutoshJatkar Год назад +28

    Really helpful Tim! The only part I would like you to update about is that the 'db.create_all(app=app)' method is obsolete in the latest version of flask-sqlalchemy. Instead we now need to us a 'with app.app_context():' to use 'db.create_all()'. Also in my PC, the new database is created in a new folder called 'instance' by default using the same code as yours. It would be great if you could explain why that happens.

    • @asethipro4952
      @asethipro4952 Год назад +5

      THANK YOU SOO MUCH THIS IS EXACTLY WHAT I NEEDED :)

    • @AshutoshJatkar
      @AshutoshJatkar Год назад

      @@asethipro4952 You are welcome!

    • @sheriffOladimeji-xn2so
      @sheriffOladimeji-xn2so 11 месяцев назад

      I used with app.app_context():
      db.create_all(), but i'm still getting some errors, when I removed it I didn't get any errors

    • @asethipro4952
      @asethipro4952 11 месяцев назад

      @@sheriffOladimeji-xn2so that's what happened to me aswell lmao

    • @log8746
      @log8746 8 месяцев назад +9

      Hi, this might be a bit late, but if you want your db file to be placed on the website folder, you need to specify the full path in the SQL_ALCHEMY_URL configuration.
      app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{path.join(app.root_path, DB_NAME)}'

  • @UltraProbe
    @UltraProbe 3 года назад +161

    I finished my other Python project and thought of exactly this. Tim never disappoints.

    • @yomama1938j
      @yomama1938j 3 года назад +5

      Hell ya

    • @Eric-dd8bk
      @Eric-dd8bk 3 года назад +1

      Can I ask you what your project was.
      Just looking for a nice but not too hard project to practice.
      Thank you.

    • @UltraProbe
      @UltraProbe 3 года назад +1

      @@Eric-dd8bk Was thinking of making a personal website (about my programming projects). Ended up starting it in Golang as I didn't need databases and login stuff, but still great video.

    • @pratiksanganii
      @pratiksanganii 3 года назад +1

      do you know theme is in his vs code?

    • @tech-gyan-web
      @tech-gyan-web Год назад

      can you send me the full code(zip) of the project? please

  • @andymonk4684
    @andymonk4684 3 года назад +46

    Great tutorial. In the Python community "underscore underscore" is called "dunder". Just a thing to ease your tongue.

    • @soupnoodles
      @soupnoodles 2 года назад +2

      Double Underscore -> Dunder

  • @Y_N0t
    @Y_N0t 3 года назад +29

    I love that you leave in typos and errors because I usually try to correct them myself to make sure that I'm understanding well.
    It's also nice to have all those modules to look into. it saves up the time of searching everywhere for interesting modules and plugins (so you get more time to practice them !)
    Also, the additional stuff like the version import methods are super interesting.
    Now I want to redo it myself and create my portfolio website for my programming projects. Thanks man I'm learning programming on the side with a full time job, your videos make it fun and practical.

    • @benjamindavis2475
      @benjamindavis2475 Год назад

      Have you been able to get a new job yet? I'm in the same boat

  • @mattng5389
    @mattng5389 Год назад +33

    Just a small note, SQLalchemy no longer accepts 'app' in create_db(), but the code has been simplified and no longer requires a function to complete the same task. Cheers!

    • @metalskull8687
      @metalskull8687 Год назад +2

      I was in these muddy waters for the past half an hour while watching corey's old videos, man. Figured out it must be because the libraries got updated but couldn't manage to find a way since. Would love it if you elaborate!

    • @charlieguthmann2531
      @charlieguthmann2531 Год назад +2

      @@metalskull8687 I've been confused about the same thing, and I can't give you a good explanation of how to solve this but if you uninstall flask-sql alchemy and reinstall it as the older version, flask-sqlalchemy==2.5.1 it should work. Hope this helps.

    • @metalskull8687
      @metalskull8687 Год назад

      @@charlieguthmann2531 It seems there's no other way around other than this. Thank you very much, it helped!

    • @hudsong2844
      @hudsong2844 Год назад +3

      bro i am not able to use
      create_all() function..

    • @mattng5389
      @mattng5389 Год назад +6

      @@hudsong2844 you can comment out the entire create_app lines and instead use
      with app.app_context():
      db.create_all()

  • @Alex-3XL
    @Alex-3XL 3 года назад +5

    For earlier versions of Python (before 3.6): note = json.loads(request.data.decode('utf-8')) instead of note = json.loads(request.data)

    • @ExtremeEd1
      @ExtremeEd1 2 года назад

      I was wondering why the deleted section wasn't working

  • @MccoyHayden
    @MccoyHayden 3 года назад +33

    This is the video I've been trying to find!!! SO EXCITED TO GET OFF WORK AND DO THIS ENTIRE VIDEO

  • @nickyfranshel1210
    @nickyfranshel1210 3 года назад +16

    For the first time in a while, I found a video tutorial thats genuinely interesting :D

  • @maximofernandez196
    @maximofernandez196 2 года назад +4

    So I actually decided to stop procrastinating, and you don't know how much you made me remember what I loved from python. Thank you so much, Tim

  • @MewVSMewtwo89
    @MewVSMewtwo89 2 года назад +4

    This tutorial is amazing. I've done it beginning to end 4 times so far and each time I understand a little more about what's going on.

    • @omkaaarmore
      @omkaaarmore 2 года назад

      bro i ran the whole thing yesterday and it was working all good but today when i tried to run it has all sorts of errors and my envn has been set to production return self.wsgi_app(environ, start_response) this types of errors occured could you help

  • @luis96xd
    @luis96xd 3 года назад +7

    Excellent video! 😄😄
    This project is so nice to begin with Flask and Python for web
    - User authorization and authentication
    - Databases
    - Creating servers with Flask
    - Using variables, loops, if sentences
    - Using HTML templates
    Thank you so much! 😄👍

  • @ethanrhett383
    @ethanrhett383 2 года назад +4

    I have watch countless web tutorial on so many different topics, and this is the best one so far. Details and pace were perfect.

  • @tobypy404
    @tobypy404 4 месяца назад +6

    Btw if you're having problems with the "generate_password_hash()" function, idk since when but they changed the sha256 method to "scrypt". It's the same just with a different name. :)

    • @John_Speaks
      @John_Speaks 3 месяца назад

      thanks bro, that really helped me a lot

    • @asiamies9153
      @asiamies9153 5 дней назад

      or 'pbkdf2:sha256'

  • @wertuxhd2881
    @wertuxhd2881 2 года назад +1

    I just watched and coded simultaneously with Tim... The only thing I couldnt manage to learn "What" Bracketss!? Keep up bro Im coding with you for 2 years now.

  • @Dante-yu8ss
    @Dante-yu8ss 2 года назад +1

    I can't think of anyone who I'd rather listen to for more than two hours straight, explaining code to me lol, I love this. very pleasant voice and character, very well done. Thank you so much!

    • @neelshha
      @neelshha 2 года назад

      I had a question... do I need to be really well versed with python to go on with this video?

  • @blueaxon
    @blueaxon 2 года назад +6

    This is the best instructional video for programming I have ever seen! Also, if the small errors were deliberate (as I suspect), this makes it all the more effective as it shows troubleshooting as well.. Absolutely fantastic !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @mantidream8179
    @mantidream8179 3 года назад +38

    Superb quality tutorial. This answered a lot of long-standing questions I had.

  • @fraan0602
    @fraan0602 Год назад +16

    Amazing tutorial! I had some experience with sql server and power bi, and web dev but not together. Super easy to follow!

  • @heitorreis4051
    @heitorreis4051 4 месяца назад

    This video changed my life! Everything I needed right now was someone that carefully explained how to create a python-based website and you helped a lot. I recommend to people that are watching the video for the first time to open the git code because on the comments there are a lot of tips and updates of parts that are deprecated. Anyway, helped a lot, you spoke clearly and was straight to the point, explaining what was needed and the basic concepts surrounding. I could even replicate with similar purposes and hope to expand even further now. Really appreciate the video.

  • @brimmae1354
    @brimmae1354 2 года назад +5

    Thank you for making this! It was very simple to follow, and I love that I went from knowing nothing about flask to having a functioning website (also thank you for posting the code in the description, that was also very helpful). This was exactly what I was looking for!

  • @Falcon8856
    @Falcon8856 10 месяцев назад +7

    Just to let other viewers know, the jenga scripts are now outdated and the code will not work anymore. Check the documentation for updated scripts that work. Other than that, great video!

  • @masoooomx
    @masoooomx 4 месяца назад +4

    2024 Update:
    1. If pip install flask does not work simply do - "pip3 install flask"
    You're welcome!

  • @rayankazi6029
    @rayankazi6029 3 года назад +5

    I was learning flask and i saw this notification
    It was like a gift from the above

    • @user-sh7lw6nl2g
      @user-sh7lw6nl2g 3 года назад

      It's called Machine Learning.
      Google knows what we want.

  • @uykerrykaberga
    @uykerrykaberga 2 года назад +1

    just want to mention, is very important to structure the project in the exact same way he has his folder (i got trouble because of that). Dude your explanation and tutorial is just amazing, thnx great way to introduce us in web dev with python and flask

  • @JayCodingPlug
    @JayCodingPlug Год назад +1

    You are great, Tim. Two years later, this is as new as ever. It's the best flask framework tutorial I have seen. Thank you a million times. 🍻 cheers

  • @huzmasood
    @huzmasood Год назад +12

    A little correction in the __init__.py's last function:
    def create_database(app):
    with app.app_context():
    if not path.exists('instance/' + DB_NAME):
    db.create_all()
    print('Created Database!')

    • @MrCrunsh
      @MrCrunsh Год назад +1

      Thank you. I currently stuck at this point! 😀

    • @aronds24
      @aronds24 Год назад

      thanks brother

    • @renebrogatzki4645
      @renebrogatzki4645 Год назад

      @user-xb3rl5bv7c that is correct, but additionally change the path from 'website/' to 'instance/'. db seems to be automatically created at a different location

    • @huzmasood
      @huzmasood Год назад

      @@renebrogatzki4645 yeah i thought that instance thing was only with me but guess that's how it's happening now. i have edited the comment now

  • @josephlang2586
    @josephlang2586 2 года назад +3

    I'm trying to build a flask crud website currently and I'm strugling heavily with the one to many relationship in my database. I reaalllyy hope this video will cover it but judging from the 5 minutes I've seen so far I can tell even if my specific issue isn't covered there's going to be a lot for me to learn from watching you.

  • @ahmedabdelkader5627
    @ahmedabdelkader5627 3 года назад +21

    Awesome stuff Tim!
    covers everything I typically need in Flask within a nice project.
    Also for the sake of simplicity, I like to flash the messages with categories equal to danger/success to match the bootstrap alert classes and the in the Jinja template, I show both types of messages in one loop like this
    {% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
    {% for category, message in messages %}
    {{ message }}
    ×

    {% endfor %}
    {% endif %}
    {% endwith %}

  • @vitostrah9917
    @vitostrah9917 Год назад +21

    For those who got an error while creating a database, try replacing line:
    db.create_all(app=app)
    with
    with app.app_context():
    db.create_all()

    • @borretje
      @borretje Год назад +1

      Thanks a lot, many examples I found on the internet fail without this.

    • @maratin93
      @maratin93 Год назад

      What's the catch?

    • @vincentvargas9251
      @vincentvargas9251 Год назад +1

      Thanks for this one. Hahahahaha im giving and writing on the stackoverflow then I saw this. It's working now

    • @aakashbharati502
      @aakashbharati502 Год назад +2

      Thanks a lot!

    • @auraphonic5150
      @auraphonic5150 Год назад +1

      i tried using this but it isnt creating the database file, any ideas there?

  • @divangrove3154
    @divangrove3154 5 месяцев назад +2

    For those who struggle with finding the database folder that should pop up at 1:34:03, check for and instance folder

  • @Orionalpha48
    @Orionalpha48 Год назад +2

    I really like that you keep your mistakes in the video, even the 'simple' things like relative importing. It definitely humanises you and makes you more relatable. It's a nice reminder that coding is hard and we're not doing simple things here.

    • @LG-ut3hw
      @LG-ut3hw Год назад

      can u help me?
      Min 28:13 he said to copy the thing
      I didn't know from where bc my English isn't good can u help me?

    • @chindaamadi317
      @chindaamadi317 Год назад

      What he meant was that you should copy it from his code base from Github.
      The link to get to his Github is below this video.

  • @haythembenhlima4158
    @haythembenhlima4158 3 года назад +5

    I have enormous gratitude towards you Tim, thank you for your effort !

  • @michaelerdstein5787
    @michaelerdstein5787 2 года назад +6

    23:00 I think If you are using VScode you can just write "!" at the beginning of the HTML file and a drop-down menu pops up and you can choose one of the items so VScode can auto-complete the framework for the HTML source code.
    I might be wrong though as I haven't really used VScode for a bit.

    • @YazhShah
      @YazhShah 2 года назад

      Yep this works in VSCode can confirm.

  • @fabrizzioorderique2343
    @fabrizzioorderique2343 3 года назад +5

    this tutorial is exactly what I have been looking for. Thank you so much!

  • @chrisknayzeh9307
    @chrisknayzeh9307 Год назад

    this video taught me more about implementing databases within a website than an entire masters degree that i already earned. thank you so much!!!

  • @craftyoldman
    @craftyoldman 2 года назад +1

    It took me a minute but I figured it out. Bootstrap 5 is slightly different. Without having to go into detail here I suggest that if anyone is using BS5 please read the documentation.

  • @krishnajoshi4511
    @krishnajoshi4511 3 года назад +5

    🔥Hey Tim, needed this one. I just wanted to use databases for my website but none were clear. Nailed it bro🔥🔥🔥. Thanks

  • @davialbuquerque4964
    @davialbuquerque4964 3 года назад +15

    Your tutorials are the best, Tim! Thanks a lot for sharing your knowledge! It's really helpful!

  • @Aelitaa4
    @Aelitaa4 3 года назад +109

    Me: sees your old Flask tutorials
    Also me: hmm, looks interesting, I'll give it a try
    A few hours later: this video appears
    Me: BRO WTF

  • @i.alegre9401
    @i.alegre9401 6 месяцев назад

    Excellent tutorial Tim. I watched many others on Flask and got no clue. After watching yours, just realised Flask is around 90% of what I already knew on front-end coding with PHP

  • @sahareyvazzade
    @sahareyvazzade 4 месяца назад

    The way you explained everything was INCREDIBLE . Thank you so much for making such a great web tutorial.

  • @whacker497
    @whacker497 23 дня назад +3

    If you are using the latest version of python and flask as of 9/1/24 you could encounter an error with sha256 not being recognized in the sign up function. replace sha256 with 'pbkdf2:sha256' and it should work

  • @noone-dc4uh
    @noone-dc4uh 2 года назад +4

    This is pure gold... 🤗🤗🤗🤗 Thank you very much Tim for this tutorial. It's a life saver 😅😅

  • @manoramapatra8091
    @manoramapatra8091 3 года назад +13

    Okay now this is very exciting for me.....

  • @BulletsNBrass
    @BulletsNBrass 2 года назад

    +1 for all the praise. It seems like every single guide I found on how to get started with Flask and any kind of web site integration for Python was all "buy this app" or "use our service" or totally glossed over critical starting point info so you had to already know how to set everything up and they just showed you some code afterward with no explanation of what parts of their starting point mattered and what didn't. As someone learning this on my own rather than through formal sources this was extremely helpful.
    I'll definitely be coming back to watch a lot more of your content as time permits.

  • @chrismcclure4264
    @chrismcclure4264 2 года назад +1

    Brilliant. I was about to be a chump and purchase a course online. However, this is better than most and for the amazing cost of free on RUclips. Thanks a million times over and never change. You rule!

  • @ayaanp
    @ayaanp 3 года назад +4

    I was getting into backend web dev in Python, and then you uploaded this :D

    • @rachit6099
      @rachit6099 3 года назад

      If Tim uploaded it 2 months before then if would be great for me

    • @nickyfranshel1210
      @nickyfranshel1210 3 года назад

      samee

  • @shiblyaziz4528
    @shiblyaziz4528 Год назад +8

    Amazing tutorial!. This is the best instructional video for programming I have ever seen!

  • @lingjati
    @lingjati 2 года назад

    i followed your tutorial, and running this web server on a arm based cpu media box, running openwrt os, everything works perfectly

  • @Morimove
    @Morimove 2 года назад +1

    I have done frontend many times with HTML CSS and JavaScript, but it's my first time in backend programming
    the video was a good video and I really appreciate your handwork
    it was great feeling after finishing this project

  • @hmm5170
    @hmm5170 3 года назад +34

    Video idea : When to learn your next programming language?

  • @fg87fgd
    @fg87fgd 3 года назад +6

    Super helpful, pal. BTW: "werkzeug" = German for "tool". Pronounce it like "verktsoik"

    • @kapilsonyt
      @kapilsonyt 3 года назад

      Das ist perfekt, danke!

  • @ugurcandemir1
    @ugurcandemir1 2 месяца назад

    Great video! Consice yet precise. One note here for those who want to take this project to the next level:
    You may use WTForms for flask to create forms more elegantly. It will also help you to modulerize you app.

  • @kojirohiori666
    @kojirohiori666 Год назад +2

    If you're having errors while creating the database, it's because the SQLAlchemy changed the method in recent versions. Try changing your "create_database()" method to this:
    def create_database(app):
    if not path.exists('website/' + DB_NAME):
    with app.app_context():
    db.create_all()
    print('Created Database!')

    • @bruc1555
      @bruc1555 Год назад

      Damn thanks just ran into this problem

    • @ThatGuyEster
      @ThatGuyEster Год назад

      but I can't see any database file created

    • @nicholasqualitza5470
      @nicholasqualitza5470 Год назад +1

      from . import db
      ImportError: attempted relative import with no known parent package
      Can you help with this as well. I keep getting this error when trying to run model. I've been searching online but not much has helped

  • @emircanertunc671
    @emircanertunc671 Год назад +4

    For those who has a problem with the delete button
    I found the solution, replace in the base.html:

    type="text/javascript"
    src="{{ url_for('static', filename='index.js') }}"

    by this

    (Thanks ChatGPT)

  • @anonymousperson7014
    @anonymousperson7014 3 года назад +33

    Tim I'm making a chat feature in my website. How do you add chat history based on the chat rooms? Could you please make a tutorial on that? Not many people make very reliable tutorials on chat apps and chat history for specific rooms. I have searched all over the web.

    • @pratiksanganii
      @pratiksanganii 3 года назад

      do you know theme is in his vs code?

    • @buritomuchacho5116
      @buritomuchacho5116 3 года назад +2

      @@pratiksanganii the name is: Identical Sublime Text Monokai theme

    • @Rikaisan
      @Rikaisan 3 года назад +28

      Doesn't sound hard, but your request is too specific, when you are trying to search how to resolve a problem like this, you need to divide the problem into sub-problems more:
      How are your chat rooms structured?
      With the structure you have right now, can you make this happen or do you need to modify it?
      So, for example, what is a chat history? it's basically a server-stored piece of text, nothing else.
      So if you are sending the messages from client to client, you'll need to first make that message go through a function that appends each message to the end of a string or file, now, how you structure the way to save the messages is up to you too: plain text or some sort of data structure so you have access to the user's id, msg, hour that it was sent, etc
      Start implementing the feature by resolving the now smaller problems (passing each message through a function, having where to save it, formatting it to your liking before saving, reading the chat history, etc) and when you get stuck, it will probably be something more general:
      Not "How to read a chat history from a database"
      But "How to get a field's content from a database"
      Or Not "How to make a function that saves chat messages into a file"
      But "How to append data to the end of a file"

    • @jgabt
      @jgabt 3 года назад +12

      Here’s the easy, lazy way
      1. Look up how to make chat rooms using flask
      2. Click the first result
      3. Select the code
      4. Ctrl+C then Ctrl+V on ur code editor.
      5. Recompile and voila!

    • @xames7789
      @xames7789 3 года назад +1

      @@jgabt 😂😂😂

  • @goge7152
    @goge7152 2 года назад

    this is my first time with python, and I'm amazed at how more straightforward it is than c++

  • @Felix-lr1xv
    @Felix-lr1xv 5 месяцев назад

    I would say that's one of the best coding tutorials I've ever watched. Thank you very much!

  • @mouadabid1272
    @mouadabid1272 3 года назад +8

    Hi ! I m following all your instructions from the start but it seems like i can t import either views or auth . An error mssg pop out (can t import name 'views" from 'website.views' whenever i try to import them in __init__.py file , thanks in advance and love your videos : )

    • @domingossiengue3670
      @domingossiengue3670 3 года назад

      having the same problem right now

    • @jonnoedge167
      @jonnoedge167 2 года назад

      Hi, did you fix this error? I am getting the same?

    • @MBorky2
      @MBorky2 Год назад

      also, I did not solved yet

  • @e4lstaff753
    @e4lstaff753 3 года назад +4

    Hello Tim
    I enjoyed your video
    Pls can you make a video on how to create the same login and sign-up system with Django

  • @kennethnzioka2904
    @kennethnzioka2904 3 года назад +7

    I'm very grateful for the effort you've put in here. It has really helped me understand python and flask better. I appreciate it.

    • @TechWithTim
      @TechWithTim  3 года назад +3

      You're very welcome!

    • @Bern9917
      @Bern9917 2 года назад

      @@TechWithTim at 37:37
      why is my text color blue?

    • @ThatGuyEster
      @ThatGuyEster Год назад

      @@Bern9917 same problem, have you fixed that?

    • @0xbobbyboy
      @0xbobbyboy Год назад

      probably missing or a typo in the nav attributes/arguments, if you have navbar-dark then the text shouldnt be blue @@Bern9917 like in this tutorial

  • @combogaming8302
    @combogaming8302 Год назад

    i can't thank u enough for this,i was struggling for building the backend for my webpage for the mini project in college.Because of u i was able to complete the login page and signup,now i just have to link the url for previously build front end ,tysm

  • @DrTortoisePHD
    @DrTortoisePHD Месяц назад +2

    the only good programming tutorial ever, you are the first person to make a tutorial that doesn't treat the viewer like they are stupid. I wouldn't be watching this if I didn't already have at the very least a basic understanding of programming. Too many tutorials over explain the basics, when they should be telling you to go learn them first.

  • @marktrinidad8691
    @marktrinidad8691 3 года назад +5

    Do you have tutorial using MySQL database as well?

  • @bluekeybo
    @bluekeybo 3 года назад +7

    Wow! Amazing video! Thank you so much! One quick typo at 1:07:43, it should say "alert-dismissable". Also, is there a much simpler way to add the delete note option? I got a bit lost with all the custom JS just for that simple function. Thank you again!

  • @mahery_ranaivoson
    @mahery_ranaivoson 3 года назад +8

    Tim, would you cover CI/CD pipeline for easy deployment. Thanks ☺️

  • @SethFX
    @SethFX 6 месяцев назад +1

    I did this. Changed it for Ticket system, and now got a promotion

  • @sitetest97
    @sitetest97 Год назад

    This is one of best tutorials I've used. The way you not only gave the code but explained most of it in way that was easy to understand. Thank you!

  • @christophrathgeber7567
    @christophrathgeber7567 3 года назад +12

    Regarding the problem at the end: Every time you make changes to the javascripts you have to clear your cashe and reload it afterwards.

    • @PaprikaYT
      @PaprikaYT 3 года назад

      Strg + F5 or Ctrl + F5

  • @taylormccoy7492
    @taylormccoy7492 Год назад +3

    If anyone else has the issue I did withe create database function here's the fix:
    def create_database(app):
    if not path.exists('website/' + DB_NAME):
    with app.app_context():
    db.create_all()
    print('Created Database!')

    • @taylormccoy7492
      @taylormccoy7492 Год назад

      @TechWithTime if you could update your github code with this or tell me why it messed up on my implementation (I used GPT to figure this out lol) that would be great. I have the rest of your code in identically.

    • @taylormccoy7492
      @taylormccoy7492 Год назад

      @TechWithTim sorry I misspelled lol

  • @jonastenora7478
    @jonastenora7478 Год назад +4

    If you get 'app' is not recognized then put this:
    with app.app_context():
    db.create_all()
    instead of create_database(app)

  • @miscellaneous3372
    @miscellaneous3372 2 года назад

    This man did the website in 2 hours. This took me 2 days LOL. Ty for the tutorial!!

  • @chrisdenman1105
    @chrisdenman1105 2 года назад +2

    Amazing!! Fast, straight to the point, and comprehensive.
    Very well done. Subscribed!!!

  • @reviewguy1766
    @reviewguy1766 3 года назад +4

    Is there anyway to do the Delete button feature with Python instead of adding JavaScript?

  • @timkraemer3223
    @timkraemer3223 Год назад +3

    Anyone else have the issue where the database file does not get created? This is from following others advice of replacing part of create_database() with:
    with app.app_context():
    db.create_all()

    • @filipjohansson5319
      @filipjohansson5319 Год назад

      Yes. This comes from the Flask path, it probably is created, just not where you want it.
      This is what I did:
      db_path = path.join(path.dirname(__file__), DB_NAME)
      db_uri = 'sqlite:///{}'.format(db_path)
      app.config['SQLALCHEMY_DATABASE_URI'] = db_uri

  • @rod6722
    @rod6722 3 года назад +4

    Right when CS50 finance was giving me headaches... Thank you!

  • @ladladpham
    @ladladpham 2 года назад

    First time I sit and watch such a long video and still I hoped it would last more...
    Congrats Tim! And thx

  • @joaoyictor
    @joaoyictor 4 месяца назад

    I have watched a lot of tutorials about it, and this is the best one so far. Congrats!😁

  • @pratyushdutta7172
    @pratyushdutta7172 2 года назад +4

    For me it says "No module named 'website'"
    when i go run the file at timing of video 12:58

  • @therollingambit5222
    @therollingambit5222 3 года назад +6

    Thanks for this Tim! Can I request a simple tutorial on flask+react? :)

  • @teodorpeev1444
    @teodorpeev1444 2 года назад +2

    What an excellent tutorial. As I advance through it I start to realize how great and easy-to-understand it is! I highly appreciate the efforts you put into making this tutorial, dear Tim!!! :)

    • @LG-ut3hw
      @LG-ut3hw Год назад

      can u help me?
      Min 28:13 he said to copy the thing
      I didn't know from where bc my English isn't good can u help me?

  • @pappachanjoshy
    @pappachanjoshy 2 года назад

    When I started with python I was struggling and when I saw you I got better and better. Thank You

  • @nathaliasouz.a
    @nathaliasouz.a Год назад

    Tim, I really appreciate your efforts to make this tutorial! As soon as I can, I'll retribute this gratefulness by being a member!

  • @DDC1324
    @DDC1324 2 года назад +3

    Has anyone else gotten "ImportError: cannot import name 'create_app' from 'website'"?

    • @adrianobarbet3282
      @adrianobarbet3282 2 года назад

      same

    • @pigeon4530
      @pigeon4530 4 месяца назад

      Exactly what I'm trying to work out at this moment. Did anybody find a solution? I'm assuming updates have gummed up the works.

    • @audio55
      @audio55 4 месяца назад

      @@pigeon4530 Run the __init__.py file first one time. That solved the problem for me

  • @huvenmoodley280
    @huvenmoodley280 3 года назад +4

    12:57:
    You can just click where it shows your interpreter instead of doing all that and also try restarting VsCode if you just installed flask

    • @sabkakatega209
      @sabkakatega209 3 года назад +2

      hey bro at 12:50 it shows cannot import create app from website(unknown location) for me in the terminal how to fix this

    • @rafeykhan224
      @rafeykhan224 2 года назад

      @@sabkakatega209 check the spelling of website......if you have change the name or w is Capital in the beginning

    • @austynnickalo7525
      @austynnickalo7525 2 года назад

      @@sabkakatega209 im having the same problem :'(

    • @sabkakatega209
      @sabkakatega209 2 года назад

      @@rafeykhan224 yeah

    • @louisgalluzzo9284
      @louisgalluzzo9284 2 года назад

      I'm new to this coding stuff. I did everything step by step here. only problem I have is whenever I run the code I get "import module error" and i only have 3 interpreters for python for some reason and they're obviously the updated ones. No matter which one II pick I still run into the same issue and having a hard time figuring it out. Help, please?