I211 Unit 3: Backend to Database

Welcome to Unit 3! We focused on the front end and back end in Unit 2—and we made the intellectual leaps required for those two views to “talk” to each other. We used a Unix-like file system for state management: storing our pages, images, and data inside of files on the opearting system. But now we have to contend with some limitations of using the file system.

When developers refer to the full stack, as in a “full-stack application” or “I’m a full-stack developer”, what they mean is they have the ability to work on all three layers of a web application.

Now we’re ready to add in that final layer: a database.

In Unit 3

We will:

  • add data to a database connected to our web application
  • use SQL (Structured Query Language) to make requests and ask questions of that data
  • have Python control our SQL requests to the database
  • update our Flask application and templates to process and display that data

You will find that once the set up is in place, applying this ‘third layer’ is actually less code and easier to understand and maintain than our previous workflow using a CSV.

CSVs are perfect for bringing data in for display, but they quickly become problematic when we want to change that data, whereas databases are designed for easy access and adjustment of data.

Let’s get started!