Python Development

This page, and these examples, are a ‘work in progress’ with a collection of GitHub examples that I’ve put together for teaching web development with Flask and Django. The examples are similar, so that it’s possible to see where the different libraries offer alternatives. All of these use Sqlite3 as the database to keep them simple.

I’ve only used these once so far, so they still need some revision to make them more complete. The goal is to offer a useful starting point to see how sites are put together starting from simple and progressing to more complex ones.

The idea for each of them is that this starter code lets students work though an example in a class session. Some repos also have a solution branch, which shows one possible way of completing the exercises.

Flask Examples

A story generator site using the Faker library to generate a story.

A temperature conversion example to see how forms work.

A polar bear open data example to see how you import and then use databases.

A shopping example to see how multiple tables link together using Faker to generate the data.

A shopping example using Behave for BDD testing.

Django Examples

Stories about Temperature using Django combines the story generator and temperature conversion examples.

Polar bears with open data using Django to see how you import data using Django models.

Polar bears with maps and charts in Django to see how you might use chart.js and leaflet.js to visualise your bear data.

Shopping example with Django to see how to add Behave tests, authentication and sessions. This has now become too big, and will need to be taken apart into a number of smaller examples.