Exercise 6: A First Flask Application

In this lab we will start building up the tools that will be required for building the backend of web applications. As this will need to respond to web requests, store data and dynamically build web pages and data structures there are a number of key technologies you will need to be familiar with.

First things first....

By now you should have formed a project group, and begun discussing your ideas for the project. You should be able to register your project using this application. The application is a small (and poorly written) flask application to record your project groups, the title of your project, and allow you to book the time you would like to demonstrate your project in week 12.

The application is running on the development flask server, and using sqlite as a database, so is not ready for full deployment, but it serves as a basic template for the sort of things you will require in your project. You can find the source code for the project on Github You can find basic instructions for running the application in the readme, and download a copy of the application from Github. However, complete the First Flask App exercise below first. Please send any questions, comments or bugs on the app to Tim.

Once you have registered your group, discuss your idea with the lab demonstrator. Try and identify the user stories involved with the project, some sample polls/ranking it may show, and sketch some interface designs.

Miguel Grinberg has produced an excellent set of tutorials for building Flask Apps. Work through the first three chapters of the mega tutorial. It is important to get your python and flask environment set up correctly. The instructions in the mega tutorial are very good, but ask for help if you don't understand anything, as this development environment will be very important for the rest of semester.

If you would like to run your web pages from early labs on your flask server, you can create a folder called static in the app directory and place the files there. When you navigate to localhost flask will look in the static directory for resources, so you can put the webpage name at the end of the local host url. You can then see your requests being sent to the flask web-server.