In this exercise, you will introduce yourself to some basic features of Apache and its plugins. In addition, one useful SSH feature is covered here.
You will need only one machine of your choice to complete this assignment. Ensure that you have Apache 2 installed together with wsgi module. The modules for serving user directory contents, rewriting URLs and setting up SSL should come with Apache by default.
Shut down any other web servers that you might be running on your virtual machine.
Set up SSH port forwarding for HTTP and HTTPS so that you can test the server on your local machine (loopback) with your favourite web browser. You should also forward port 8000 (used by Django's internal server).
1.1 | In the above command ":8080:localhost:80" where is the 'localhost' resolved? | 0.5p |
1.2 | What do the ports '8080' and '8443' refer to? Whats the idea? | 0.5p |
1.3 | How is it possible to do multiple port forwards with a single SSH connection? | 0.5p |
Check that Django (1.4) and Python 2.7 are installed. Install Django with pip rather than apt-get so you get the correct version. Note: you are allowed to do this assignment with a framework other than Django but assistants won't give any help and the example application (which is written in Python) probably won't work without serious modifications.
Next, modify your project's settings:
Next, install application helloapp, which you can download from Material-section of this page, unzip and place the helloapp folder in your Django project folder. Do the following modifications to your project:
- helloapp's index is found at url /hello/
- details of a hellotext is found at /hello/hello_id/
- page informing about a newly received hellotext is at /hello/newmsg/
2.1 | Provide a working solution (both helloapp and admin interface work) | 3p |
2.2 | Why are we using sqlite in this exercise? Is it a good database backend for a "real" web service? | 1p |
2.3 | What's the difference between the templates and static files? | 1p |
3.1 | Provide and explain your solution. | 1p |
3.2 | What information can a certificate include? What is necessary for it to work in the context of a web server? | 1p |
3.3 | What do PKI and requesting a certificate mean? | 1p |
4.1 | Provide and explain your solution. | 2p |
4.2 | What is HSTS? | 1p |
5.1 | Provide a working solution (1p) with correctly displayed UI (1p) | 2p |
5.2 | What is REST? What do HTTP methods GET and POST have to do with it? | 1p |
5.3 | Can the helloapp example be considered as RESTful? | 1p |
5.4 | What kind of representation (formats) would be preferred if we want to create a machine-readable REST API? | 1p |
6.1 | When to use .htaccess? In contrast, when not to use it? | 1p |
6.2 | Are there other application frameworks for web services than Django? | 1p |
|
|
|||
---|---|---|---|---|
Helloapp | Django application for assingments 2 & 5 (updated Oct 3rd, removed unnecessary files) | |||