Skip to content

Latest commit

 

History

History
78 lines (40 loc) · 2.47 KB

README.md

File metadata and controls

78 lines (40 loc) · 2.47 KB

US Senators Flask Boilerplate App

Getting started

From your command line, run the following to download the repo to your own computer:

$ git clone https://github.com/stanfordjournalism/flask-boilerplate-senator-faces.git

To run the app, which starts a webserver on your own machine at the address (URL) of 127.0.0.1:5000 (aka localhost:5000:

$ cd flask-boilerplate-senator-faces
$ python app.py

Exploratory edits/tasks

Best way to get acquainted with the moving parts of this web application is to edit the code yourself.

Open the project folder in your text editor:

img

Editing plain old HTML

A web application can serve up plain old static HTML, i.e. a text file that never changes.

Messing around with CSS

This app includes the Bootstrap 4 (Alpha) framework, which is documented here: https://v4-alpha.getbootstrap.com/

Understanding Jinja templating and dynamic pages

Jinja is a mini-programming language that allows the use of code in otherwise plain HTML files:

Changing the application code in app.py

Changing how the data is wrangled in the helpers code

More step-by-step here: http://www.compjour.org/lessons/flask-single-page/hello-tiny-flask-app/

References

Senator images from: https://github.com/unitedstates/images

Legislator data: https://sunlightlabs.github.io/congress/#legislator-spreadsheet

The legislator data as a Google Spreadsheet.

Sen. Ted Cruz on ProPublica Represent

Flask app tutorial: http://www.compjour.org/homework/flask-app-101/