Here is the code we developed in class. You can upload the code, and run it in web2py. I advise you to study it carefully: it contains many key tricks and suggestions that will be useful to you for the homework and for the project.
I also advise you to read the Overview chapter from the web2py book.