Connected to a database and used queries to retrieve data to be passed to templates