You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/08/19 14:21:11 UTC

[airavata-django-portal] branch master updated: gateways19 tutorial: setting up local django

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/master by this push:
     new b64307b  gateways19 tutorial: setting up local django
b64307b is described below

commit b64307b63489ab58383e63a25fa2b53da1eece3b
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Aug 19 10:20:51 2019 -0400

    gateways19 tutorial: setting up local django
---
 README.md                              | 57 +++++++++++++++---------
 docs/tutorial/gateways2019_tutorial.md | 81 ++++++++++++++++++++++++++++++++++
 mkdocs.yml                             |  3 +-
 3 files changed, 118 insertions(+), 23 deletions(-)

diff --git a/README.md b/README.md
index a4ba587..595af61 100644
--- a/README.md
+++ b/README.md
@@ -3,24 +3,24 @@
 [![Build Status](https://travis-ci.org/apache/airavata-django-portal.svg?branch=master)](https://travis-ci.org/apache/airavata-django-portal)
 [![Build Status](https://readthedocs.org/projects/apache-airavata-django-portal/badge/?version=latest)](https://apache-airavata-django-portal.readthedocs.io/en/latest/?badge=latest)
 
-The Airavata Django Portal is a web interface to the [Apache
-Airavata](http://airavata.apache.org/) API implemented using the Django web
-framework. The intention is that the Airavata Django Portal can be used as is
-for a full featured web based science gateway but it can also be customized
+The Airavata Django Portal is a web interface to the
+[Apache Airavata](http://airavata.apache.org/) API implemented using the Django
+web framework. The intention is that the Airavata Django Portal can be used as
+is for a full featured web based science gateway but it can also be customized
 through various plugins to add more domain specific functionality as needed.
 
 ## Getting Started
 
-The following steps will help you quickly get started with running the
-Airavata Django Portal locally. This will allow you to try it out and can
-also be used as a development environment.
+The following steps will help you quickly get started with running the Airavata
+Django Portal locally. This will allow you to try it out and can also be used as
+a development environment.
 
 The Airavata Django Portal is developed with Python 3.6 but should also work
 with 3.4 and 3.5. You'll need one of these versions installed locally.
 
-You'll also need npm 6.4.1+ to build the JavaScript frontend code.
-Please install [the most recent LTS version of
-Node.js](https://nodejs.org/en/download/).
+You'll also need npm 6.4.1+ to build the JavaScript frontend code. Please
+install
+[the most recent LTS version of Node.js](https://nodejs.org/en/download/).
 
 1.  Checkout this project and create a virtual environment.
 
@@ -32,6 +32,12 @@ Node.js](https://nodejs.org/en/download/).
     pip install -r requirements.txt
     ```
 
+    - **macOS note**: to install the MySQL dependencies you need to have the
+      MySQL development headers and libraries installed. Also, on macOS you need
+      to have openssl installed. See the
+      [mysqlclient-python installation notes](https://github.com/PyMySQL/mysqlclient-python#install)
+      for more details.
+
 2.  Create a local settings file. Copy
     `django_airavata/settings_local.py.sample` to
     `django_airavata/settings_local.py` and edit the contents to match your
@@ -43,7 +49,9 @@ Node.js](https://nodejs.org/en/download/).
     python manage.py migrate
     ```
 
-4.  Build the JavaScript sources. There are a few JavaScript packages in the source tree, colocated with the Django apps in which they are used. The `build_js.sh` script will build them all.
+4.  Build the JavaScript sources. There are a few JavaScript packages in the
+    source tree, colocated with the Django apps in which they are used. The
+    `build_js.sh` script will build them all.
 
     ```
     ./build_js.sh
@@ -69,37 +77,42 @@ Node.js](https://nodejs.org/en/download/).
           export OAUTHLIB_INSECURE_TRANSPORT=1
           ```
 
-6.  Point your browser to http://localhost:8000.
+7.  Point your browser to http://localhost:8000.
 
 ## Documentation
 
 Documentation currently is available at
-https://apache-airavata-django-portal.readthedocs.io/en/latest/ (built from
-the 'docs' directory).
+https://apache-airavata-django-portal.readthedocs.io/en/latest/ (built from the
+'docs' directory).
+
+To build the documentation locally, first
+[set up a development environment](#setting-up-development-environment), then
+run the following in the root of the project:
 
-To build the documentation locally, first [set up a development
-environment](#setting-up-development-environment), then run the following in
-the root of the project:
 ```
 mkdocs serve
 ```
 
 ## Feedback
 
-Please send feedback to the mailing list at <de...@airavata.apache.org>. If you encounter bugs or would like to request a new feature you can do so in the [Airavata Jira project](https://issues.apache.org/jira/projects/AIRAVATA) (just select the _Django Portal_ component when you make your issue).
+Please send feedback to the mailing list at <de...@airavata.apache.org>. If you
+encounter bugs or would like to request a new feature you can do so in the
+[Airavata Jira project](https://issues.apache.org/jira/projects/AIRAVATA) (just
+select the _Django Portal_ component when you make your issue).
 
 ## Contributing
 
-For general information on how to contribute, please see the [Get Involved](http://airavata.apache.org/get-involved.html) section of the Apache Airavata website.
+For general information on how to contribute, please see the
+[Get Involved](http://airavata.apache.org/get-involved.html) section of the
+Apache Airavata website.
 
 ### Setting up development environment
 
 Run `pip install -r requirements-dev.txt` to install development and testing
 libraries.
 
-Use a code editor that integrates with editorconfig and flake8. I also
-recommend autopep8 for automatically formatting code to follow the PEP8
-guidelines.
+Use a code editor that integrates with editorconfig and flake8. I also recommend
+autopep8 for automatically formatting code to follow the PEP8 guidelines.
 
 ## License
 
diff --git a/docs/tutorial/gateways2019_tutorial.md b/docs/tutorial/gateways2019_tutorial.md
index 00a6129..74f6ff7 100644
--- a/docs/tutorial/gateways2019_tutorial.md
+++ b/docs/tutorial/gateways2019_tutorial.md
@@ -162,3 +162,84 @@ In addition to customizing the UI component you can also apply validations:
 
 Also you can define dependencies between application inputs and show or hide
 inputs based on the values of other inputs.
+
+## (Optional) Tutorial exercise: Create a custom UI component to customize input interface
+
+TBD
+
+## Tutorial exercise: Create a custom output viewers for an output file
+
+By default, the Django portal provides a very simple view for output files that
+allows users to download the file to their local machine. However, it is
+possible to provide additional custom views for output files. Examples include:
+
+- image (visualization)
+- link (perhaps to another web application that can visualize the file)
+- chart
+- parameterized notebook
+
+To be able to create a custom output viewer we'll need to write some Python
+code. First, we'll get a local version of the Django portal running which we'll
+use as a developer environment.
+
+1. Make sure you have Python 3.6+ installed. See
+   [https://www.python.org/downloads/]() for downloadable packages.
+2. You'll also need npm 6.4.1+ to build the JavaScript frontend code. Please
+   install
+   [the most recent LTS version of Node.js](https://nodejs.org/en/download/).
+3. Clone the airavata-django-portal project and create a virtual environment.
+
+```bash
+git clone https://github.com/apache/airavata-django-portal.git
+cd airavata-django-portal
+python3 -m venv venv
+source venv/bin/activate
+pip install -r requirements.txt
+```
+
+4. Now we'll clone another repository that has some supporting files for this
+   tutorial. Change into the parent directory and clone
+   [https://github.com/machristie/gateways19-tutorial]()
+
+```bash
+cd ..
+git clone https://github.com/machristie/gateways19-tutorial.git
+```
+
+5. Copy the `settings_local.py` file from this repo into the Django portal repo:
+
+```bash
+cp gateways19-tutorial/settings_local.py airavata-django-portal/django_airavata/
+```
+
+6. Back in the Django portal repo we'll run the Django migrate command.
+
+```bash
+cd airavata-django-portal
+python manage.py migrate
+```
+
+7. Load a starting set of CMS pages for the portal
+
+```bash
+python manage.py load_default_gateway
+```
+
+8. Build the JavaScript sources for the portal. This one will take some time to
+   complete.
+
+```bash
+./build_js.sh
+```
+
+Once the build finishes we can start the Django server and log in and see our
+experiments.
+
+```bash
+export OAUTHLIB_INSECURE_TRANSPORT=1
+python manage.py runserver
+```
+
+Go to [http://localhost:8080](), click on **Login in**, enter your username and
+password. On the dashboard you should see the your experiments listed on the
+right hand side.
diff --git a/mkdocs.yml b/mkdocs.yml
index 09b4d60..6225661 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -16,4 +16,5 @@ nav:
 theme: readthedocs
 
 markdown_extensions:
-  - mdx_truly_sane_lists
+  - mdx_truly_sane_lists # allow 2 space indent
+  - sane_lists # allow restarting numbering of ordered lists