A document from MCS 275 Spring 2022, instructor David Dumas. You can also get the notebook file.

MCS 275 Spring 2022 Homework 14 Solutions

  • Course Instructor: David Dumas
  • Solutions prepared by: Johnny Joyce

Instructions:

  • Complete the problems below, which ask you to write Python scripts.
  • Upload your python code directly to gradescope, i.e. upload the .py files containing your work. (If you upload a screenshot or other file format, you won't get credit.)

Deadline

This homework assignment must be submitted in Gradescope by Noon central time on Tuesday 26 April 2022.

Special note

This is the last homework assignment. Congratulations on making it this far!

Collaboration

Collaboration is prohibited, and you may only access resources (books, online, etc.) listed below.

Resources you may consult

These things might be helpful while working on the problems. Remember that for worksheets, we don't strictly limit what resources you can consult, so these are only suggestions.

Point distribution

This homework assignment has one problems. The grading breakdown is:

Points Item
2 Autograder
4 Problem 2
6 Total

The part marked "autograder" reflects points assigned to your submission based on some simple automated checks for Python syntax, etc.. The result of these checks is shown immediately after you submit.

What to do if you're stuck

Ask your instructor a question by email, in office hours, or on discord.

( No problem 1 as usual )

Problem 2 - Show that you can run a Flask + SQLite application on your computer

MCS 275 labs were cancelled this week, so while Worksheet 14 was available and I recommended everyone work on it, I realize you had fewer opportunities than usual to practice the latest material and ask course staff for assistance.

In recognition of this, I've scaled back the homework this time. You don't need to write any new code or solve any new problems. I just want to see that you are able to run a Flask application that involves a SQL database on your own computer (or whatever computer you use for MCS 275 assignments and/or labs).

Specifically, please do the following:

  • Run a Flask application that uses a SQLite database on your computer. See the list below for some examples.
  • Open a browser and load a page from the flask application
  • Make sure the terminal window where Flask is running and the browser window where you loaded the application are both visible in their entirety on your screen.
  • Upload the following things to gradescope:
    • A screenshot from your computer showing both the terminal and browser windows, in PNG, BMP, JPG, TIFF, or HEIC format (PNG preferred).
    • The Python source code of the application that's running in your screenshot (not necessarily code that you wrote; I just want a copy that exactly matches what you show in the screenshot)

What Flask application?

It could be:

  • The starter version of Speaker Slate given as part of Worksheet 14
  • The finished version of Speaker Slate from your work on Worksheet 14
  • The example program WorkSnap developed in lecture
  • Your partial Project 4 work, if it is at the point where it runs and uses both Flask and SQLite
  • Any other open-source Flask+SQLite application written in Python that runs on Python 3.8 and which requires no external modules other than flask, sqlite3, and other modules specifically taught in MCS 275.

Grading checklist

Full credit is given if:

  • There is a screenshot
  • The screenshot appears to have been captured by you as part of your work on this assignment
  • It shows a terminal with a Flask application running
  • It also shows a browser window in which a page of that same Flask application is open
  • The Python source of the Flask application you showed in the screenshot has been uploaded to Gradescope as part of your submission.
  • The Flask application you uploaded and which is shown in the screenshot uses a SQLite database.

How do I take a screenshot

See these instructions: https://www.take-a-screenshot.org/

Solution

Here's an example of a screenshot (with the WorkSnap Flask application from lectures)

Example screenshot