Getting started

This section is intended for developers new to the database who want to get up and running with a test instance quickly.

Before you start

You should have done the following things before starting to work on the database:

  1. Get a machine running Unix-like OS or Mac OS X. (It makes life easier in the long run when dealing with Python.)
  2. Install Python and virtualenv.
  3. Work through the Django tutorial.

Running a test instance with fake data

Clone the repository and cd to it. The remaining instructions assume the repository root is the current working directory.

Create a virtualenv:

$ virtualenv -p $(which python2.7) env
$ echo "env" >>.git/info/exclude # To avoid any accidental commits
$ . env/bin/activate

Install the requirements:

$ pip install -r requirements.txt -r dev-requirements.txt


The requirements.txt file lists the Python packages required for deployment. The dev-requirements.txt file lists the Python packages used only by developers. For example, the “ipython” package, which is used to improve the shell_plus command, is in the dev-requirements.txt file since it is not required when deploying the database.

Perform the initial database migration and populate the database with some fake data:

$ ./edpcmentoring/ migrate
$ ./edpcmentoring/ runscript loadtestfixtures

Start a local development server:

$ ./edpcmentoring/ runserver_plus

Open in your web browser. The admin interface is at

Installing on UIS MWS3 (

You will need:

  • To register and create an MWS3 server (see link above)
  • The root password for MySQL server (available once you MWS3 has been setup)

ssh onto your MWS3 server (via putty, or a linux/unix console), then:

$ cd /var/www/default/admindir
$ git clone
$ python edpcmentoring/deploy/

You will be asked for

  • The server’s MySQL root password.
  • A short name which will be prefixed by ‘pc_‘ and used as the database name
  • A password the Django applicatoin will use to connect to the MySQL server
  • A unique passphrase / secret key for your application
  • Whether you wish to load the sample test data into the application

Once complete you should be able to visit the mws3’s host name and, if you have loaded the test data, login as test000X.


The local config is held in edpcmentoring/edpcmentoring/edpcmentoring/, and DEBUG is set to True - not advised for production systems.

Notes on the test database

  • There is one superuser: test0001.
  • The users test0001 and test0002 can log into the admin interface.
  • Users test0001 to test0099 are members of CUED but not all are active.
  • Users test0100 to test0199 exist in the database but are not CUED members.


This section contains some important information if you’re thinking of developing a feature for the database.


The test suite for the mentoring database is run via the tox test-runner. If you’re intending to develop a feature for the database, it is important that you write tests. By default, tox will run tests using whichever Python version correspond to the installed python and python3 binaries.

Install tox via pip:

$ pip install --user tox

You can now run the tests via the tox command:

$ tox

Any positional arguments are passed to the underlying invocation of test and so you can specify a particular application to test by giving it’s directory. For example:

$ tox edpcmentoring/cuedmembers

Code coverage

The tests are run under the coverage code-coverage utility and files which do not have 100% test coverage are printed out after the tests are run. Additionally, a HTML report is generated in htmlcov/ which is useful for determining which lines are untested.

Although 100% code coverage is probably infeasible in general, we aim for as close as possible in the database. Pull requests which increase test code coverage are welcome.