Skip to content

Initial Installation

Professor Colin Turner edited this page Sep 20, 2018 · 2 revisions

Initial Installation

The precise details of installing a Django app under your web server will depend a bit by Web Server and Operating System.

Downloading the Code

You can download the code using git itself, or download one of the formal releases. I'd only recommend using git itself if you know what you are doing with that tool.

Operating System and Environment

First you will need to select an Operating System and Environment. Django apps can run on most Operating Systems, with most Web Servers and with most Database Backends.

One possibility is Debian GNU/Linux, in which case, install

aptitude install apache2 python3-django libapache2-mod-wsgi-py3

will probably get most of the packages you want. On a Debian system, custom software should be installed under

/usr/local/share

so you should unpack the code there. But the precise details vary. You might find this example useful.

Initial Configuration

Once you have the software installed, you should edit settings.py to at least change the secret, and probably your database to the values you desire. Details here. Note that out of the box the choice will be sqlite, which may be a poor choice for production.

You will need to create the database schema, do this with

python3 manage.py migrate

while in the directory with manage.py. This creates the schema, but you may find it useful to populate some very basic default configuration. This can be done with

python3 manage.py populate_database --add-core-config -v 3

which will add some Categories, Activity Types, Module Sizes and a basic AssessmentState workflow.

Adding Test Data

You may find it useful to populate some test data to let you play with the system. You can do this with

python3 manage.py populate_database --add-test-data -v 3

which will create a WorkPackage, and a Group and some staff, by default using "TEST" as a prefix. You can use the optional --test-prefix to change this, which can be useful if you want several distinct test data sets. The users created can't log in directly.

Adding a Super User

python3 manage.py create_superuser

will create a superuser account. You should now be able to login, but may not be able to see anything. Click on the Admin Interface and go to Users. Add your Superuser account to the Groups you want to be able to see (particularly if you created test data above). You should now be able to see and manipulate data.