密码学代写|CP3404 Assignment 1

这是一个英国的Python&Django服务器开发Web代写assignment

1. The Brief

In this project, you will use the Django framework to implement a RESTful web API for rating professors. You will host your website on www.pythonanywhere.com (for free). You will also write a simple command line application for interacting with the API.

2. The Web Service

We want to develop a RESTful web service to allow students to rate the teaching of professors in various modules on a scale from 1 to 5. The service must provide all the required web API’s to allow client applications to offer the functionality described below.

The service maintains data about professors, modules, and the rating of professors by different users (students). Information about modules and professors are manually added by the admin of the service using the admin site. The admin site is automatically created by the Django web development framework.

A module may be:

• Taught by different professors in different academic years.

• Taught by different professors in different semesters.

• Taught by more than one professor at the same time (for example each teaching some part
of the module).

Since an academic year spans two calendar years (e.g. 2018-19), an academic year will be given by its first year only (hence 2018-19 is given as 2018).

Users of the service (students) can rate professors but cannot add or change module information.

Before they can rate professors, users must register by providing a username, email, and password.

Users can only rate professors when they are logged in to the service. The overall rating of a professor is the average of the professor’s rating by all users across all module instances taught by this professor. A module instance is a module taught in a certain year and semester by one or more professors. Any decimal fraction in the average is rounded to the nearest integer.

A client application connected to the service will provide the user with the following options:

Option 1. View a list of all module instances and the professor(s) teaching each of them. Here is an example of a possible client application output for this option.

Note that modules and professors are given unique identifiers in the web service to avoid any possible mix-up between names.

Option 2. View the rating of all professors. Here is an example of a possible client application output for this option.

The rating of Professor J. Excellent (JE1) is *****
The rating of Professor T. Terrible (TT1) is *
The rating of Professor V. Smart (VS1) is **

Option 3. View the average rating of a certain professor in a certain module:
The rating of Professor V. Smart (VS1) in module Computing for Dummies (CD1) is ***

Option 4. Rate the teaching of a certain professor in a certain module instance.
Note that all filtering of data and calculations should be done by the server, i.e. the client application does not process incoming data; the application simply displays the data returned by the service in a human readable format.

You are required to:

1. Design and implement a suitable database for the above service. You must specify all required tables, the fields of each table and their data types, and the relationships between the tables.

2. Design and implement all web API’s that must be provided by the service to allow a client application to perform the functionality described in Options 1 – 4. For each API, you must specify: the purpose of the API, a URL, an HTTP method, the request data, and the response data.

3. The Client Application

You are also required to write a command line client application to interact with the API. The application should be written in Python 3 and should be able to send requests to, and process responses from, the web service. The client must support the following commands:

register

This is used to allow a user to register to the service using a username, email and a password. When the command is invoked, the program prompts the user to enter the username, email, and password of the new user. The syntax for this command is:

register
login

This command is used to log in to the service. The syntax for this command is:

login url