LearnFlask with SQLAlchemy Basics

writes on February 25, 2021

Today we released “Flask with SQLAlchemy Basics,” an all-new course from Treehouse instructorMegan 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?

Flask is apopular 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:

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.

  1. 为项目创建一个文件夹
  2. Open your folder in your IDE
  3. Open the terminal in your IDE
  4. 创建虚拟环境
    1. Mac: `python3 -m venv env`
    2. Windows: `python -m venv env`
  5. 激活您的环境
    1. Mac: `source ./env/bin/activate`
    2. Windows: `.\env\Scripts\activate`
  6. Install Flask
    1. “pip安装瓶”
  7. Create requirements file
    1. `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:

  • 软件工程师
  • Web Developer
  • Junior Web Developer

Companies that hire for roles that require Flask include:

  • Software companies
  • Creative agencies
  • Finance firms
  • E-commerce stores

There are879 open positionsthat 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 Basicsincludes video instruction, code challenges, quizzes, and more. You can take the Treehouse course for free with a seven day free trial. Then, dive into morePython或者SQLcontent 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 yourfree seven day trial.

What sets Treehouse apart is their dedication to helping you find your perfect job or develop your own business. –SwitchUp.org

跟着我们Twitter,Instagram, andFacebook对于我们最喜欢的提示,并分享您的学习方式。我们会在那里见到你!



You must belogged in发表评论。

Want to learn more about Python?

Learn the general purpose programming language Python and you will be able to build applications and tools.

Learn more