Skip to content

Running the web app locally

Melanie Clarke edited this page Feb 2, 2023 · 8 revisions

If you are developing the JWQL web app, any changes that you make won't appear on the development, test, or production versions of the web page until your changes are merged. In order to see your changes in real time, you need to start a local server session on your own machine to render your local web app files.

Follow these steps to get a local server session running:

  1. Activate your jwql virtual environment:

    conda activate jwql-<version>
  2. Navigate to the website directory:

    cd jwql/website/
  3. If you have not done so already, create appropriate symbolic links that point to static contents located in central storage:

    ln -s <path_to_filesystem> apps/jwql/static/filesystem
    ln -s <path_to_thumbails> apps/jwql/static/thumbnails
    ln -s <path_to_preview_images> apps/jwql/static/preview_images
    ln -s <path_to_outputs> apps/jwql/static/outputs

    You can ask a JWQL team member for the appropriate paths.

  4. Make and apply new migrations for the jwql app to create Django model tables:

    python manage.py makemigrations jwql
    python manage.py migrate
  5. Populate the tables with the available static data:

    python apps/jwql/archive_database_update.py

    This will take some time to run.

  6. Make yourself a superuser for your local databases:

    python manage.py createsuperuser

    Enter 'admin' for the user name, your email address, and a password.

  7. Start a local server to run the web app:

    python manage.py runserver
  8. View the web app in your browser: http://127.0.0.1:8000.

    There should be thumbnails linked to proposal data and images, under the NIRCAM Archived Images link, for example.

  9. View the admin interface at: http://127.0.0.1:8000/admin.

    The tables should be populated with the static data from central storage.

Expert Shortcut

If you're not thrilled about having to do this every time you want to launch the website, you can add the following alias to your ~/.bash_profile (be sure to update the version number and the path to your JWQL repo):

alias launch_jwql='conda activate jwql-<version>; python /path/to/repo/jwql/jwql/website/manage.py runserver'

Then, to launch the web app, just type launch_jwql in any terminal window. Voilá!