School of Computer Science and Software Engineering

CITS3403 Agile Web Development — Lab06

Unit Coordinator

Dr Tim French

Phone: 64882794

Lab Facilitator

Mr Tom Smoker, Mr Haolin Wu

 

Consultation Time

Where: CSSE rm 2.14
Time: Wednesday 12-2pm
No appointment needed.

 

News:

  • [14 Feb 2020] This unit currently has 190 CITS3403 students and 40 CITS5505 students enrolled. Almost twice as many as last year!
  • [14 Feb 2020] Labs, lectures and workshops all start in week 1.
  • [24 Feb 2020] Update: Labs will be starting in week 2.
  • [24 Feb 2020] Welcome to the first day of semester. The first class will be the lecture on Wednesday at 2.

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.

  • Git for version control, and also deploying a project to a production environment.
  • The Flask web application framework. This framework runs the web application, and is written in Python Similiar alternatives are Django (also python), Ruby on Rails, and NodeJS.
  • A templating language. This allows us to programatically build html pages, by mixing python in with html. We will be using jinja2, but there are many alteratives inlduing pug, erb and others.
  • A database management system. We will use sqlite, which is good for prototyping but should not be used for production systems. Alternatives are mysql and postgress for relational databases, and mongo or neo4j for nosql databases
  • Tools for deploying the system. We will use heroku which is a docker container service that can host small applications. Alternatives are linux virtual machines through Digital Ocean or others, various solutions through Amazon Web Services or you could host your own server.
We will just look at the first two tasks today.

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.

A Bit of Git

  1. Familiarise yourself with Git. Do the basic introduction from code school.
  2. Become an expert with Git. Read the full tutorial from Atlassian.
  3. Set up a GitHub account (if you haven't got one already). You can get a student account which is important, asit will give you free private repositories, so no other students can accidently find and borrow your code.
  4. Working with you partner, link a GitHub project with your individual development environments. Try a series of commits, pushes, checkouts (forks) and merges, and then undo them.
  5. A first flask app

    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.


This Page

Last Edited on:
Friday 12th of April 2019 10:34:23 AM

Website Feedback:
[email protected]