PRIMAVERA-H2020 / primavera-dmt

PRIMAVERA Data Management Tool
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Tests DOI

primavera-dmt

PRIMAVERA Data Management Tool

This is the original version of the DMT developed and implemented for the PRIMAVERA project. This version makes some assumptions about the layout of the storage at JASMIN and all data files must comply with the CMIP6 metadata standards. Development of a more generic successor has begun at https://github.com/MetOffice/primavera-dmt and everyone is invited to use or contribute to the new version.

Quick set-up

  1. Load a Conda or virtualenv environment containing:

    django  
    django-filter  
    django-solo  
    django-tables2
    mock
    netcdftime  
    iris  

    For example in Conda:

    conda create -n primavera-dmt -c conda-forge python=3.7 django=2.2 django-filter mock netcdftime iris
    source activate primavera-dmt
    pip install django-solo django-tables2

    Alternatively, if the validation of files won't be run then Iris isn't required and all requirements can be installed via pip:

    python -m pip install --upgrade pip
    pip install -r requirements.txt 

    If validation will be run then clone the primavera-val code:

    git clone https://github.com/PRIMAVERA-H2020/primavera-val.git
    export PYTHONPATH=$PYTHONPATH:./primavera-val
  2. Create local settings:

    $ cp pdata_site/settings_local.py.tmpl pdata_site/settings_local.py  

    Populate the value of SECRET_KEY on line 23 of pdata_site/settings_local.py with a suitable random string. A string can be generated from the command line:

    $ python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
  3. Django set-up:

    mkdir db
    python manage.py makemigrations pdata_app
    python manage.py migrate
  4. Run tests:

    python manage.py test

    If Iris wasn't installed then the validation tests should be skipped:

    python manage.py test --exclude-tag=validation
  5. View the website in a local development server: In pdata_site/settings.py enable debug mode by changing line 19 to:

    DEBUG = True

    Start the development server:

    $ python manage.py runserver

    Point your browser at http://localhost:8000/ to view the site.