# ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png) Variables and Routing in Flask
---

## Overview
The first half of this lesson focuses on variables in Flask — pulling them from the file itself, other Python files, and then other files of different types. The second half of the lesson covers creating and navigating to routes and variable routes.

---


## Learning Objectives
In this lesson, students will:

- Display variables on a webpage.
- Create a route in Flask.

----

## Duration
60 minutes

---

## Suggested Agenda
<!--- Provide a breakdown of what will happen in this lesson. --->

| Time | Activity | Purpose |
| --- | --- | --- |
| 0:00 - 0:02 | [Welcome](#activity-welcome-2-min) | Introduce the lesson’s objectives and agenda. |
| 0:02 - 0:30 | [Variables](#activity-variables-28-min) | Import variables in the context of a Flask app. |
| 0:30 - 0:57 | [Routes](#activity-routes-27-min) | Cover what routes are and how to make them. |
| 0:57 - 0:60  | [Summary](#activity-summary-3-min) | Wrap up the learning and share next steps. |

## Materials and Preparation
- If your class is picking things up quickly, you might want to, in advance, come up with a few exercises that combine routing with variables.

## Differentiation and Extensions
- Students having a more difficult time with this might want to revisit the lecture on functions and variables.
- For students who grasp it easily, have them experiment with putting routes and the different variable methods together and see what happens.

---
---

## Lesson Procedure

---

### Activity: Welcome (2 minutes)
> Introduce the lesson’s objectives and agenda.

---

### Activity: Variables (28 minutes)
> Import variables in the context of a Flask app.

> **Teaching Tips:**
> - Go over when each method is best. Recommend to students that reading in a file from another Python file is more pythonic and, ultimately, less code
> - If you have time, give students leeway to practice multiple things multiple ways.


---

### Activity: Routes (27 minutes)
> Cover what routes are and how to make them.

> **Teaching Tips:**
> - Add more exercises wherever possible. Give more difficult programs to print and display on each route.
> - If a student asks why only the main page has styling, table it! Templates are next.


---

### Activity: Summary (3 minutes)
> Wrap up the learning and share next steps.
