Developer installation

The developer installation allows the user to edit the Thunor Web source code, and is intended for use by those wishing to customize, develop, or contribute to the Thunor Web software. It is NOT a secure configuration to run across a network, and should not be run on a publicly accessible server. For that, see full installation, which is simpler to get up and running and recommended for most users.

This installation uses Python directly on your computer (i.e. not in a Docker container), Django's built in webserver, and a PostgreSQL database. Some Python/Django experience is recommended.

Requirements

  • The quickstart procedure requires Docker and Docker Compose v2 (i.e. docker compose should work, without a dash), which are used to launch a PostgreSQL database server. Advanced users may prefer to install their own PostgreSQL server or utilize an existing one instead. To use PostgreSQL in a Docker container, install one of the following:
  • A Python >= 3.6 installation. If you have not used Python before, we recommend installing Anaconda.
  • Git. If you're not sure if you have git, it will be provided with the Anaconda download in the previous step.

Getting Started

  1. Create a virtual environment. This allows Thunor Web to keep its Python dependencies separate from other programs on your machine. You can do this with Anaconda (described here), or with virtualenv or pyenv, if you prefer. On Anaconda, to create an environment called thunor and activate it, run the following:

    conda create -n thunor pip python=3.6
    conda activate thunor
    
  2. Download Thunor Web. Change directory to where you want to download the software, then type:

    git clone --recurse-submodules https://github.com/alubbock/thunor-web
    cd thunor-web
    
  3. Run the Thunor Web initialization script

    python thunorbld.py init
    
  4. Create an admin account. You can use this to log in.

    python manage.py createsuperuser
    
  5. Start the development server

    python manage.py runserver
    

That's it! You can now access Thunor Web on your local machine by accessing http://localhost:8000 through a web browser.

Shut down the system

When you're done with testing, you can shut down the system as follows.

  1. Stop the development server if it's running, by pressing Ctrl+C
  2. Shut down the database by running docker compose down in the thunor-web directory.

Re-start Thunor Web at a later date

To re-start Thunor Web at a later date:

  1. Activate the virtual environment: conda activate thunor
  2. Change directory to the thunor-web installation location
  3. Make sure the database is started: docker compose up -d
  4. Start the development server: python manage.py runserver

Uninstallation

Simply shutdown the system as above, then delete the thunor-web directory (noting that this will delete all data in Thunor Web, of course). If you're using Anaconda, you can deactivate the virtual environment with conda deactivate and delete it with conda env remove -n thunor.

Further configuration options

For more configuration options that can be set as environment variables, see configuration options. You can set those environment variables in the thunor-dev.env file.

Making modifications

Changes to Python files should be reloaded automatically by the development server. If changing any static files (within thunorweb/webpack/thunorweb), you'll need to trigger a webpack build:

python thunorbld.py --dev makestatic

Unit tests

To run the unit test suite on the host machine's Python environment:

python thunorbld.py --dev test

Generally, the above test suite is sufficient, but to run the test suite in a Docker container (to mimic the production environment), run

python thunorbld.py test