Table Of Contents
Table Of Contents

Static and Workspaces Directories

Last Updated: September 2022

1. Create Static Directory

Static files include all files in the public or static directories of Tethys Portal and apps and examples include JavaScript, CSS, and images. As the name implies, static files are not dynamically generated and can be served directly by NGINX, which will be able to do so much more efficiently than the Daphne-Django server could. You will need to collect all of the static files into one directory for NGINX to be able to more easily host them. This can be done as follows:

  1. Get the value of the static directory from the STATIC_ROOT setting:

    tethys settings --get STATIC_ROOT
    

    Tip

    You may set the STATIC_ROOT variable to point at whichever directory you would like as follows:

    tethys settings --set STATIC_ROOT /my/custom/static/directory
    
  2. Create the static directory if it does not already exist

    sudo mkdir -p <STATIC_ROOT>
    sudo chown -R $USER <STATIC_ROOT>
    

    Note

    Replace <STATIC_ROOT> with the value returned by the previous command (see step 1.1).

  3. Collect the static files to the STATIC_ROOT location:

    tethys manage collectstatic
    

2. Create App Workspaces Directory

The app workspaces directory is one location where all app workspaces are collected. The app workspaces typically store files that are generated by the app while it is being used and often this data needs to be preserved. Collecting all of the workspaces of apps to a single location makes it easier to provision storage for the workspaces and backup the data contained therein. Setup the app workspace directory as follows:

  1. Get the value of the static directory from the TETHYS_WORKSPACES_ROOT setting:

    tethys settings --get TETHYS_WORKSPACES_ROOT
    

    Tip

    You may set the TETHYS_WORKSPACES_ROOT variable to point at whichever directory you would like as follows:

    tethys settings --set TETHYS_WORKSPACES_ROOT /my/custom/static/directory
    
  2. Create the workspaces directory if it does not already exist

    sudo mkdir -p <TETHYS_WORKSPACES_ROOT>
    sudo chown -R $USER <TETHYS_WORKSPACES_ROOT>
    

    Note

    Replace <TETHYS_WORKSPACES_ROOT> with the value returned by the previous command (see step 2.1).

  3. Collect the app workspaces to the TETHYS_WORKSPACES_ROOT location:

    tethys manage collectworkspaces
    

Tip

The TETHYS_WORKSPACES_ROOT directory is one of the recommended directories to backup.

Tip

You can collect both the static files and the app workspaces with a single command:

tethys manage collectall