Today we released “Flask with SQLAlchemy Basics,” an all-new course from Treehouse instructor Megan Amendola. This 147 minute Python course will teach you how to: Create a website or web app with Flask, connect a Flask website with an SQLite database using SQLAlchemy, create HTML templates, and connect static files.
You should learn Flask because… it’s simple to read and understand, and it’s versatile. It has a wide variety of applications, and supports numerous extensions. Companies like LinkedIn and Pinterest are using the Flask framework for their web applications.
In this article, you’ll learn:
- What is Flask?
- How to install Flask
- Creating a basic website with Flask
- Job titles and companies hiring Flask developers
- Learn Flask with SQLAlchemy with Treehouse
What is Flask?
Flask is a popular Python framework for creating websites and/or web applications. A framework is a collection of code that makes building something easier. Flask will help us to create a website. Because it has written a lot of the code for us, we just need to learn how to use these new tools. Flask helps us work with the request-response cycle. Take a look at what that means with this clip that we shared on Twitter:
NEW Course – Flask with SQLAlchemy Basics!
Learn how to use the popular Python framework for creating websites and web applications, Flask. Then upgrade your website with a database connection using SQLAlchemy.
— Treehouse (@treehouse) February 25, 2021
A user requests information from your site, your site determines how to handle the request and what information to send back, and then a response is sent to the user. So when a user asks for Treehouse’s homepage, the site will receive the request and send back the homepage’s information.
How to install Flask
Here’s how to create a virtual environment to practice using Flask. You can use whichever IDE (integrated development environment) that you’re comfortable with. Megan uses Visual Studio.
- Create a folder for your project
- Open your folder in your IDE
- Open the terminal in your IDE
- Create a virtual environment
- Mac: `python3 -m venv env`
- Windows: `python -m venv env`
- Activate your environment
- Mac: `source ./env/bin/activate`
- Windows: `.\env\Scripts\activate`
- Install Flask
- `pip install flask`
- Create requirements file
- `pip freeze > requirements.txt`
Now your project requirements file is ready if you want to create a repo for this project and others end up wanting to run your project to check it out. If you do want to post this on GitHub, then you can also create a .gitignore file. Inside write env to ignore this folder. Others will only need the requirements file to download the right packages and start your project.
Create a basic website with Flask with SQLAlchemy
Are you ready to jump into the world of Flask? Megan walks you through some of the basic steps in a livestream we shared this week. (You can sign up to stay notified of future livestreams from Treehouse instructors here.) Check it out:
Job titles and companies hiring Flask developers
Python Developers use Flask for a lot of the work related to their job, but they aren’t the only ones. Common job titles that use Flask include:
- Software Engineer
- Web Developer
- Junior Web Developer
Companies that hire for roles that require Flask include:
- Software companies
- Creative agencies
- Finance firms
- E-commerce stores
There are 879 open positions that include “Flask Python Developer” keywords on Indeed.com right now, with salaries up to $150,000 per year.
Learn Flask with SQLAlchemy with Treehouse
Flask with SQLAlchemy Basics includes video instruction, code challenges, quizzes, and more. You can take the Treehouse course for free with a seven day free trial. Then, dive into more Python ; SQL content with your Treehouse subscription.
Related Treehouse Tracks for beginners:
Related Treehouse Courses:
Learning with Treehouse starts at only $25 per month. If you think you’re ready to start exploring if tech is right for you, sign up for your free seven day trial.
What sets Treehouse apart is their dedication to helping you find your perfect job or develop your own business. – SwitchUp.org
If you liked reading this article, you should also look at these three:
- SQLAlchemy Basics
- The Best Places to Look for Your First Tech Job
- 5 Treehouse Students Who Found Tech Jobs in Less than a Year