REST API With Flask & SQL Alchemy

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

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

  • @1cannon3
    @1cannon3 5 ปีที่แล้ว +184

    0:27 - Intro to tutorial
    1:00 - Intro to the other packages used in this tutorial (SQLAlchemy, Marshmallow, PostMan)
    2:01 - Creating virtual environment (Pipenv)
    3:09 - Installing dependencies
    4:10 - Create main file (app.py)
    5:43 - Initialize flask and run server
    7:02 - Creating a basic route
    7:58 - Making POST request in Postman
    8:18 - Setting up database URI
    9:04 - Setting up database
    10:46 - Initialize database
    11:00 - Initialize Marshmallow
    11:23 - Creating a class for your resource(s)
    16:13 - Creating a product schema (This is where we use Marshmallow)
    17:13 - Initialize schema
    17:56 - Another schema initialization
    18:50 - Creating the database
    20:04 - Creating our routes
    20:15 - "Create a product" route ('/product')
    23:30 - Making a POST request in Postman
    24:50 - Creating "fetch all products" route
    25:40 - SQLAlchemy .all() method
    26:46 - Testing get all products in Postman
    27:28 - Creating "get single product" route
    29:29 - Creating "update a product" route
    31:35 - Making a PUT request to product in Postman
    32:21 - Create a delete route
    33:49 - Making a DELETE request in Postman

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

      Everything is easy if you put them in a single module, you should organise your app in a proper structure and then explain what you are doing.

  • @MoltiSanti
    @MoltiSanti ปีที่แล้ว +20

    If when running "db.create_all()" from the Python interpreter you experience "RuntimeError: Working outside of application context.", instead run the following three lines:
    >>> from app import app, db
    >>> app.app_context().push()
    >>> db.create_all()

    • @tastes-like-straberries
      @tastes-like-straberries ปีที่แล้ว +2

      was looking for this. thanks sm

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

      thanks!!

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

      really thanks

    • @AhmadLiaqat-dj1dm
      @AhmadLiaqat-dj1dm 6 หลายเดือนก่อน

      instead you can ad a line of code in you app.py file "# Create all tables within the application context
      with app.app_context():
      db.create_all()
      "

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

    Another great video thank you.
    If anyone gets the error "AttributeError: 'list' object has no attribute 'data'", it's because since Marshmallow v3 you don't need the .data attribute as dump returns the data directly ...
    def get_products():
    all_products = Product.query.all()
    result = products_schema.dump(all_products)
    return jsonify(result)

    • @teclote
      @teclote 9 หลายเดือนก่อน

      Thank you.

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

    For people coming across this video in June 2021. I had a few issues using the latest versions of everything.
    1. At 18 minutes the schema no longer requires strict = True.
    2. At 16.30, result.data should be result.

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

      legend, thanks

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

    Just for someone who gets stuck when they get all products, the "result" variable will be default be an array/list so you don't need the `data` you can just jsonify(result)

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

    For anyone using this now, and update to Marshmallow (from documentation):
    Setting the strict option on class Meta has no effect on Schema behavior. Passing strict=True or strict=False to the Schema constructor will raise a TypeError.

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

    Thank you for presenting an example by using my favorite two tools - pipenv and vscode. They save so much time and effort. I also ALWAYS create a git repository for projects, even if they are the throwaway kind. As of this date, marshmallow is version 3.0 and the "strict" key is no longer needed or allowed.

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

    Quite old, some methods are not the same right now. But it's definitely a good tutorial.
    The strict param is not accepted right now for marshmallow (product(s)_schema)
    For the get_all the following lines are the new ones:
    all_products = Product.query.all()
    return products_schema.jsonify(all_products)

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

      Thank you so much, it saved a lot of time
      Also, could you tell if dump() is depreciated?

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

      thanks man

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

    Thank you! I’m coming from node web backends and just tryna switch it up and start using python instead. Most tutorials were just brushing over the basics without explaining and getting straight to the point. Thank you brad, you’re THE best!

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

    Hi Traversy, Thanks so much for this video. I had been reading a lot and trying to get the concept of such an API but it was confusing to me mostly because many tutorials start off by putting different things in different files and then they import different modules into each other-it's just too confusing for a beginner. So thanks to God you put everything in a single file and gave us an overview. You have no idea how that is important to me.

  • @imbayi
    @imbayi 5 ปีที่แล้ว +93

    This channel is the gift that keeps giving.

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

      Make sure you give back ;)

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

    Still useful in 2022. Thanks so much for this tutorial. I can't believe how easy this was to implement.

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

    For anyone confused about how the table name is generated, I just realized that on executing the db.create_all() command, a table with same name as the lower cased Class name gets created in SQLite database, so in this case a table named 'product' is created with the defined schema. Also, if Class name has a name like MyProduct then table would be named as my_product.

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

    Breaking Marshmallow changes since the version used to record this tutorial.
    3.0.0b7 (2018-02-03)
    Features:
    Backwards-incompatible: Schemas are always strict (#377). The strict parameter is removed.
    Backwards-incompatible: Schema().load and Schema().dump return data instead of a (data, errors) tuple (#598).

  • @ua83
    @ua83 5 ปีที่แล้ว +94

    Thanks for the video Brad. kudos.
    I was getting this error when sending a GET to return all the Products,
    To fix it I returned jsonify(result) instead of jsonify(result.data)
    I hope it will save someone else time
    =)

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

      Came here to find this exact problem

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

      this solved my issue too of not finding 'data'

    • @georgitanev-w4b
      @georgitanev-w4b 5 ปีที่แล้ว +1

      This was my last issue with the code. Thanks.

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

      I was just about to comment this myself. Cheers!

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

      You save my time, thanks

  • @k.santiagodiaz3744
    @k.santiagodiaz3744 4 ปีที่แล้ว

    Flask is ridiculously simple to work with Rest APIs. So grateful with this tutorial

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

    Awesome tutorial, it clearly shows why Flask is the best framework for python API development.
    You can also use Flask-Restful to define your endpoints.
    It give you all the HTTP verbs ready, your endpoints will be called resources rather than routes.
    Thanks Brad for your hard work and dedication.

    • @12PnT12
      @12PnT12 ปีที่แล้ว

      I was introduced to FastAPI and never want to look back! It feels like a sucessor to flask: inspired by it, but adding a lot of structure and validation with parameters and type hints.

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

    For anyone following this tutorial in 2021 The strict parameter was removed. Schemas are always strict.
    So
    product_schema = ProductSchema()
    products_schema = ProductSchema(many=True)

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

    Thanks for a quick introduction to Flask REST API. I am working on a React/Flask application for IT Inventory system. I was looking for something quick on Flask REST API development.

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

    Thank you so much for this.
    As a part of an interview assignment, I was given a task to create a CRUD system and expose APIs for a table.
    Starting from absolutely 0 knowledge about Flask, I was able to fully develop it thanks to you.
    Thank you so much!
    Do let me know if there is some way I can buy you a couple of beers (your Paypal?)

  • @senned27
    @senned27 5 ปีที่แล้ว +6

    I would really appreciate a tutorial on how this could work with NoSQL! Great work, Brad.

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

    Thank you Brad, i learn anything from node js, react js, and today currently learn python(flask) from you. I prefer with how you teach some thing

  • @howards5205
    @howards5205 5 ปีที่แล้ว +11

    Thank you for providing such great content. However, I believe many of us would like to see this project expanded further. Right now, as great this tutorial might be, it's not suitable to use for any real-world application. Some things I would like to see are: breaking the app.py into multiple files to separate out the models and routes, using token authentication, implementing model relationships, etc. I hope you please consider. Thank you.

  • @flat9safety
    @flat9safety 5 ปีที่แล้ว

    Just a note:
    jsonify does more than the simple conversion (if I'm not mistaken), it actually does some other prep steps to make it ready to be used as a response. For a simple conversion, you can use the built in module `json` ... json_string = json.dumps(som_python_dict)

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

    I love this; that you make real projects now days that are more "complete" and not just 'frontend', but I would like to see more front-end, please. E.g. you could explain how 'content: ""' works when people use it "before" and "after" when they do these seemingly magic stuff. How does it work? Looks like magic to me, and would like to know more about it.

  • @TheCodebookInc
    @TheCodebookInc 5 ปีที่แล้ว +9

    I really love Flask coz it's is similar to express when it comes to build apis but I would love to watch a video with authentication added to this via Rest. Anyways your contents are making our lives in this competitive world easier. Thanks teacher

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

    If you're getting an empty object for your JSON response, you need to add the 'many' option to the 'dump' method.
    dump(arr_objs, many=True)

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

    I am currently studying this same topic, great having Brad’s take on it.

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

    Once again a simple and perfect demonstration, love your work! Keep it up

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

    My lunch break well spent watching another Brad tutorial!

  • @topdog91
    @topdog91 5 ปีที่แล้ว

    Nice. Lots of online documentation is a bit out of date and will recommend flask-restful or flask-restplus. A better alternative is the stack you use, plus flask-classful. So easy and lightweight.

  • @kaiman6539
    @kaiman6539 5 ปีที่แล้ว

    I m currently working on a project with the exact same tools and man I needed a video like this on

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

    Hi Brad, I've been following your channel for the past few months. I have learnt HTML and CSS as well as Python from your channel. I was forced to learn Java in my college as part our curriculum (which I find hard as a first time coder) and currently, we are going to make an Android app Although I find React Native to be really efficient, my professors, insist that I should make an app through Java. Can you include a crash course on Java and Android Studio. sorry if I'm asking too much. Your work is awesome as always

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

    Thank you for this video. Please make a video on 'Flask as Rest API and Angular as the Front end.' Thumbs up.

  • @Ash-em5pm
    @Ash-em5pm 5 ปีที่แล้ว +26

    Is this some sort of magic?
    I swear I was reading flask documentation and now you post a video. Thank you so MUCH
    BTWBrad, what magic classes do you take,?

    • @TraversyMedia
      @TraversyMedia  5 ปีที่แล้ว +18

      Come on, you know I can't tell you that. Nice try though :)

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

      I was just looking into it too! Brad is in tune

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

      me too.

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

    Nice tutorial. It is clearly the best I have seen since I began Flask API.
    But, one of my biggest questions I always not answered. This question is the next one:
    How would you structure a complete API in Flask?
    Have you some resource which can answer to this or any public project which can be used as example?

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

    No need for strict=True, now schemas are always strict!

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

      Had a lot of issue with that then i just remove it completely and also in return just jsonfy(result)

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

    Watched this late, but the information is still relevant! A life save! Thanks Brad!

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

    18:00 - When initialising the schema object, the strict argument is no longer valid, for the newer versions of SQLAlchemy.

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

      Thank you very much for that. I removed strict=True for now

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

    Thank you very much for this tutorial.
    product_schema = ProductSchema(strict=True) was throwing up an error for the flask server. So I omitted it and the program ran without any hiccups. I had to use the POSTMAN desktop app to request the API.
    Thank a lot again.
    Regards Ed

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

    This was a great video that explained some elements that I hadn't quite grasped within my existing API. Covered all CRUD scenarios however I feel "Add Multiple Products" would have just finished those scenarios off.

  • @takich9317
    @takich9317 5 ปีที่แล้ว +37

    Hi, am getting an error, (TypeError: __init__() got an unexpected keyword argument 'strict') any advice

    • @denniskuria5945
      @denniskuria5945 5 ปีที่แล้ว +7

      Got same errors too. I removed 'strict' and it worked.

    • @johnnysim1985
      @johnnysim1985 5 ปีที่แล้ว

      Also getting this error, anyone know why?

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

      @@johnnysim1985 new version release. Schemas are always strict so no need.

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

      CzemBri ;p

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

      @@KushChoudhary Thanks

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

    If you found an error about strict or marshmallow. Install the packages following this version:
    marshmallow==3.0.0b6
    marshmallow-sqlalchemy==0.15.0

  • @本名出さない設定
    @本名出さない設定 2 ปีที่แล้ว

    Thanks from Japan.
    Your video is very useful to me.
    Thank you very much.

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

    Thanks for very nice explanation. It is explained in such a way that beginner gets confidence to go ahead without any frustration.

  • @semrana1986
    @semrana1986 5 ปีที่แล้ว

    1. Brad uploads a video
    2. Click on the video
    3. Click on Like btn
    4. Watch the entire vid in a single sitting
    5. Repeat

  • @its_magnetic
    @its_magnetic 5 ปีที่แล้ว

    Thank you from India 🇮🇳 Sikkim.

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

    Awesome video. could you make a small video that integrates a flask backend and a react frontend. I would like to know how the data flows between both ends. More so how to send data from the frontend and receive it in the flask backend. Please if you do get a chance make a video on it. Thank you.

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

    Ohhhh Thankssss Brad .You are the best .I am just Searching for this tutorial ......Love you man...

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

    For a REST API I think it would be better to showcase the PATCH method for updating a product. There is a whole debate to be had about idempotence, but most of the time you do not want to supply the entire product in order to update a single field. Especially if the API is not consumed by a frontend, but utilized directly by an end-user to fetch and modify data.

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

    Hey Brad, you are a gift from the Web Dev Gods.

  • @frikishaan
    @frikishaan 5 ปีที่แล้ว

    This year is going to be awesome for your students first React and now this. Thanks Sir!

  • @teclote
    @teclote 9 หลายเดือนก่อน

    Outstanding, so clear and simple, thank you.

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

    Dont know why Traversy decided to create the database in the terminal makes no sense to me, instead import create_engine from sqlalchemy, then engine=create_engine(use the url Traversy uses) then db.Model.metadata.create_all(engine) and thats it ! You can add ‘if not database_exists(engine.url): db.Model.metadata etc.’ to only create database if it does not exist, that will make your program portable. There are many ways to check if a database exists but installing the sqlalchemy_utils and importing database_exists is easier

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

      Tell me more about this please, Have you any videos concerning this?

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

    Attribute data on Get All Products is not required. Should be removed so the function should read -
    @app.route('/product', methods=['GET'])
    def get_products():
    all_products = Product.query.all()
    result = products_schema.dump(all_products)
    return jsonify(result)
    Hope this helps someone!

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

    Great video. This looks so simple I wish I could find a gig doing Python and Flask everyday :)

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

    UPDATES IN MARSHMALLOW:
    1) all schemas are strict by default now - so (strict=True) is giving errors
    2) result will give you the data by default now - so (result.data) is trowing an error

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

      How can I get a nested json output?

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

    Brad, I'm a big fan of you. please do the full project-based course of a flask in udemy.

  • @eugenesmykov3797
    @eugenesmykov3797 5 ปีที่แล้ว

    I'm a simple man. When I see new video from Brad - put like on it

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

    Good Tutorial Thanks Brad Might be something new with Marshmellow but I think that this is the correct synatax - # Init Schema
    product_schema = ProductSchema()
    products_schema = ProductSchema(many=True)
    I tried it with strict and it was dropping an error .. above worked.

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

    Excellent tutorial. So far I have not figured out how to place classes in a separate file. Any suggestions on that?

  • @panteliskaramolegkos2693
    @panteliskaramolegkos2693 5 ปีที่แล้ว

    Very nice tutorial. Would it be possible to elaborate at some point about the necessity of Marshmallow? I didn't quite get why it is being used.

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

    Pipenv is my fav package at the moment! So awesome!

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

    Thanks for sharing a little of knowledge. This makes the world a better place.

  • @kingportipher4469
    @kingportipher4469 5 หลายเดือนก่อน

    If you have an empty json output after post request, Change the "Fields" to "fields" in the product schema

  • @uweopfern
    @uweopfern 5 ปีที่แล้ว +25

    Thats nice Brad, can yu make authentication on this API

    • @TraversyMedia
      @TraversyMedia  5 ปีที่แล้ว +16

      I will see if I can do that

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

      @@TraversyMedia that will be fine, and also how to deploy flask app on do with mysql db

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

      ​@@TraversyMedia Authentication to this API, pleeeeease :)

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

      Yes you can use Flask-Login and Flask-Jwt for auth.

    • @IgnacioStegmayer
      @IgnacioStegmayer 5 ปีที่แล้ว

      @@TraversyMedia yes please! this is exactly what I want to learn!

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

    You will probably get the same error when you try 'GET' for all products. Here is the solution stackoverflow.com/questions/60529230/flask-marshmallow-attributeerror-list-object-has-no-attribute-data

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

    Great Tutorial for the Flask beginners! Thanks a lot.

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

    Excellent video once again Brad!!! I would be grateful if you could do a Flask React app with deployment!

  • @tylorg7971
    @tylorg7971 5 ปีที่แล้ว

    I was watching your other flask tutorial just the other day, so this video came at the perfect time. Thanks, Brad! I've even been telling my girlfriend about you.

  • @keon-r6l
    @keon-r6l 11 วันที่ผ่านมา

    Great content, as always! Just a quick off-topic question: I have a SafePal wallet with USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). How should I go about transferring them to Binance?

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

    You might want to check RestPlus.

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

    This is a great tutorial. Thanks for putting this up. Definitely saving this video.

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

    Great video Brad, would like to see with MongoDB

  • @jwchavez
    @jwchavez 5 ปีที่แล้ว

    Great video as ever guys. Have a nice and successful 2019 , best wishes from México to both of you!

  • @himanshukarki
    @himanshukarki 5 ปีที่แล้ว

    Great Video man... keep the good work. It was a really really good learning. Many thanks for putting this effort and spreading useful knowledge.

  • @EdniltonRauh
    @EdniltonRauh 5 ปีที่แล้ว

    Thanks Brad, your RestFull video is pretty cool. I would like to learn more about Restfull and MongoDb using Tuples, if you are thinking of a tutorial so I will wait for the bell to ring !!!

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

    Thank you Brad, It is very good tutorial. The sample code works for me.

  • @adsbix5337
    @adsbix5337 5 ปีที่แล้ว

    thank you so much sir , It's easy to use, and feels modern and natural.

  • @nassav3
    @nassav3 5 ปีที่แล้ว

    Awesome video! I have been wondering how to make a API. Thank you !

  • @michael.028
    @michael.028 4 ปีที่แล้ว +4

    On the get all products route I had to remove .data from result in order to see my products. I was getting the error, " 'list' object has no attribute 'data' ".

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

      Use return jsonify(result) instead. You don't need .data

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

    Thanks for the awesome vid, really easy to follow and learned so much

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

    Really good video for the basics, thanks !

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

    Really clear tutorial, thank you very much!

  • @markgoldstein
    @markgoldstein 5 ปีที่แล้ว

    Fantastic video! I would love to see this as a udemy course. Did you end up connecting a front end to this?

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

    Flask_Restful and SQLAlchemy work together just fine.
    Overwriting built-ins is a no-no!

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

    *marshmallow product schema's are now strict by default so the strict argument in ProductSchma() will give an error; also, "you don't need to access .data attribute, dump already returns the data." @line 60 during 26:40

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

      Thank you so much

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

    Awesome, you're making our life easy..thanks!

  • @gianmarcoferrara3397
    @gianmarcoferrara3397 5 ปีที่แล้ว

    Hi Brad, I would be very happy to have a tutorial about Gatsby + Netlify CMS, I'd be interested to learn the JAM stack.

  • @TeacupChinese
    @TeacupChinese 5 ปีที่แล้ว

    Isn't it better to use a query param like product?id=[ID] rather than product/[ID] ? And how would we do it? Also, please do a video where you show us how to add authentication and a front-end.

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

    line 60-> return jsonify(result)

  • @robsonsilv4.
    @robsonsilv4. 5 ปีที่แล้ว

    You read my mind! Awesome! Blueprint and RESTPlus is also a good next video(s)

  • @howuhh8960
    @howuhh8960 5 ปีที่แล้ว

    you can use pathlib instead of os
    much more comfortable work with paths

  • @bhavikakapadia2462
    @bhavikakapadia2462 5 ปีที่แล้ว

    I am learning Django now but after watching your tutorial it seems like
    Flask is very easy compared to Django

    • @mahmoudtokura
      @mahmoudtokura 5 ปีที่แล้ว

      Flask is easier than Django and it scale very well but Django has some features like authentication already built into it.
      I personally use Flask because it's harder to change your project from Django if you want to use a different framework in the future.
      Flask for API & Vue for frontend, thank me later.
      But Django has more jobs online so there is that to consider.

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

    Thanks Brad ! Lots of Love

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

      No problem, thanks for watching :)

  • @lordswaggity1213
    @lordswaggity1213 5 ปีที่แล้ว

    I make a rest API using flask and elasticsearch and Brad posts a video on it a day after. 🤨🤔🙄🙂

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

    I am getting error
    400 Bad Request
    Bad Request
    Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)

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

    If you guys find error : AttributeError: 'list' object has no attribute 'data', just change the code ''jsonify(result.data)" to "jsonify(result)" in get all product

  • @usmanmaqbool7758
    @usmanmaqbool7758 5 ปีที่แล้ว

    Thank you very much sir I really appreciate your work . Which helps me alot ❤.

  • @xx482
    @xx482 5 ปีที่แล้ว

    Thanks for the Video , you and your videos are reference guides to me when ever i am stuck up some where . I just want to know one thing once an api is built how do we show the same on UI , i just want few directions