Last time, we learned how to get Flask set up. In this article, we will learn how to add a database to our music data website. As you might recall, Flask is a micro-web-framework. That means it doesn't come with an Object Relational Mapper (ORM) like Django does. If you want to add database interactivity, then you need to add it yourself or install an extension. I personally like SQLAlchemy, so I thought it was nice that there is a ready-made extension for adding SQLAlchemy to Flask called Flask-SQLAlchemy.
To install Flask-SQLAlchemy, you just need to use pip. Make sure that you are in your activated virtual environment that we created in the first part of this series before you run the following or you'll end up installing the extension to your base Python instead of your virtual environment:
No comments:
Post a Comment