Overview

In this course, we’ll use a Python module called Flask to build our websites. Today’s prep gets you started understanding what Flask is and getting Flask installed so that you can focus on coding in class. If you run into difficulties with installation, please reach out asap!

Basic Learning Objectives

Before class, you should be able to:

  • Explain what Flask is
  • Explain what a web framework is
  • Describe the tasks that a web framework like Flask carries out
  • Have Flask installed on your personal machine

Advanced Learning Objectives

After class, you should be able to:

  • Use Flask to create a basic website
  • Use route parameters to dynamically change your website

Readings

You should read the following and get started with installing Flask on your own machine. The Flask people recommend and like virtual environments, which make sense in many situations, however will probably be more of a headache than they are useful in this course. So, I recommend that you ignore any discussion of ‘venv’ and instead install Flask with Python’s provided installer:

pip3 install Flask

If that doesn’t work for some reason, try:

python3 -m pip install Flask

To achieve the basic learning objectives, you should read the following sections of the Flask Tutorial on pythonbasics.org and try out the Hello World app:

  1. What is Flask
  2. Flask Tutorial - Hello World
  3. Flask Tutorial - Routes (ignore the ‘flask route post’ section)

Checks

Write down answers to the following and bring them to class:

  1. What is a web framework?
  2. List one advantage of using Flask as opposed to another web framework.
  3. What is a route, and how is it used in Flask?
  4. What is one route parameter that you could use in your team project that would recreate your command line functionality in the browser?