- Create a python script that initializes a SQLite database and create a table
movies. - The table should have the following columns:
imdb_id TEXTwe'll use the IMDB movie IDs as a unique identifier and PRIMARY KEYtitle TEXTyear INTrating DOUBLEsynopsis TEXT
- Add some movies to the table.
- [movies.sql] holds some SQL scripts you could use.
Alternatively, you can just execute the movies.sql script from the command line:
$ sqlite3 ./database.db < movies.sql
Update Exercise 4 from the last lecture on flask such that movies are loaded from the MySQL database.
Specifically,
- Remove the
MOVIESconst; this data will need to be loaded from the database. - Make a connection to the database (make sure the DB and the movies table have been created).
- Make a
SELECTquery that returns all movies from the table. - Notice that are not storing the IMDB URLs in the database. You'll need to generate the links to the IMDB movie pages from the
imdb_idfield. Do that in themovies.htmltemplate file (i.e., not inapp.py).
The output should look exactly as before:

Generate a separate "details" page for each movie.
- Remove the links to the IMDB profile page from the movie listing. Instead, make the title of the movie a link to
/movie/<movie_id>, wheremovie_idrefers to theidfield in themoviestable. - Make a
layout.htmlfile that contain a common header and footer. The movie listing and movie details pages should extendlayout.html.

