For this phase:
Put all of your files in a directory called webapp3 on thacker, and call your main page index.py instead of webapp.py or whatever it's called now.
Get your data into your PostgreSQL database.
Modify your Python code to use psycopg2 to extract data from the database for two of your most important queries. Assuming you have a DataSource class designed as described in the previous assignment, you should be able to put all the psycopg2 code in DataSource.
When I say "your most important queries," I'm thinking about the searches that your users would be most likely to perform with your data. For my (city, year, population) data, for example, I'm thinking my most important queries are:
SELECT * FROM populations WHERE year=[USER-SUPPLIED YEAR] ORDER BY population DESC
SELECT year, population FROM populations WHERE city=[USER-SUPPLIED CITY] ORDER BY year
That is, show me the cities for a given year, and show me the populations over time for a given city. These are very simple queries, but crucial ones.
Modify your HTML form, if necessary, to enable me to perform your two important queries.
Here is a sample Python script using psycopg2. There are also some psycopg2 links in the navigation panel on the course page,
Hand in by putting files in webapp3, and loading your data into your PostgreSQL database on thacker.