airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 04/06: Revert "AIRAVATA-2984 Load webpack-stats.json from STATIC_ROOT"
Date Wed, 02 Oct 2019 19:01:49 GMT
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

commit 794b4ac25189b6910b5d7746775333053931f583
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Mon Aug 12 19:45:11 2019 -0400

    Revert "AIRAVATA-2984 Load webpack-stats.json from STATIC_ROOT"
    
    This reverts commit e2b13d4808601f3cb0e5f04846aa7681297996e1.
---
 django_airavata/settings.py            | 63 ++++++++++++++++++++++++--
 django_airavata/webpack_loader_util.py | 82 ----------------------------------
 docs/dev/new_django_app.md             | 15 +++----
 3 files changed, 66 insertions(+), 94 deletions(-)

diff --git a/django_airavata/settings.py b/django_airavata/settings.py
index 3e63a54..58bce54 100644
--- a/django_airavata/settings.py
+++ b/django_airavata/settings.py
@@ -15,8 +15,6 @@ from importlib import import_module
 
 from pkg_resources import iter_entry_points
 
-from . import webpack_loader_util
-
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
@@ -277,7 +275,66 @@ AUTHENTICATION_OPTIONS = {
 THRIFT_CLIENT_POOL_KEEPALIVE = 5
 
 # Webpack loader
-WEBPACK_LOADER = webpack_loader_util.create_webpack_loader_config()
+WEBPACK_LOADER = {
+    'COMMON': {
+        'BUNDLE_DIR_NAME': 'common/dist/',
+        'STATS_FILE': os.path.join(
+            BASE_DIR,
+            'django_airavata',
+            'static',
+            'common',
+            'dist',
+            'webpack-stats.json'),
+    },
+    'ADMIN': {
+        'BUNDLE_DIR_NAME': 'django_airavata_admin/dist/',
+        'STATS_FILE': os.path.join(
+            BASE_DIR,
+            'django_airavata',
+            'apps',
+            'admin',
+            'static',
+            'django_airavata_admin',
+            'dist',
+            'webpack-stats.json'),
+    },
+    'DATAPARSERS': {
+        'BUNDLE_DIR_NAME': 'django_airavata_dataparsers/dist/',
+        'STATS_FILE': os.path.join(
+            BASE_DIR,
+            'django_airavata',
+            'apps',
+            'dataparsers',
+            'static',
+            'django_airavata_dataparsers',
+            'dist',
+            'webpack-stats.json'),
+    },
+    'GROUPS': {
+        'BUNDLE_DIR_NAME': 'django_airavata_groups/dist/',
+        'STATS_FILE': os.path.join(
+            BASE_DIR,
+            'django_airavata',
+            'apps',
+            'groups',
+            'static',
+            'django_airavata_groups',
+            'dist',
+            'webpack-stats.json'),
+    },
+    'WORKSPACE': {
+        'BUNDLE_DIR_NAME': 'django_airavata_workspace/dist/',
+        'STATS_FILE': os.path.join(
+            BASE_DIR,
+            'django_airavata',
+            'apps',
+            'workspace',
+            'static',
+            'django_airavata_workspace',
+            'dist',
+            'webpack-stats.json'),
+    },
+}
 
 LOGGING = {
     'version': 1,
diff --git a/django_airavata/webpack_loader_util.py b/django_airavata/webpack_loader_util.py
deleted file mode 100644
index 8d30375..0000000
--- a/django_airavata/webpack_loader_util.py
+++ /dev/null
@@ -1,82 +0,0 @@
-"""Utilities for working with webpack_loader."""
-import os
-
-BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-
-def create_webpack_loader_config(static_root=None):
-    return {
-        'COMMON': {
-            'BUNDLE_DIR_NAME': 'common/dist/',
-            'STATS_FILE': os.path.join(
-                static_root if static_root else
-                os.path.join(
-                    BASE_DIR,
-                    'django_airavata',
-                    'static',
-                ),
-                'common',
-                'dist',
-                'webpack-stats.json'),
-        },
-        'ADMIN': {
-            'BUNDLE_DIR_NAME': 'django_airavata_admin/dist/',
-            'STATS_FILE': os.path.join(
-                static_root if static_root else
-                os.path.join(
-                    BASE_DIR,
-                    'django_airavata',
-                    'apps',
-                    'admin',
-                    'static',
-                ),
-                'django_airavata_admin',
-                'dist',
-                'webpack-stats.json'),
-        },
-        'DATAPARSERS': {
-            'BUNDLE_DIR_NAME': 'django_airavata_dataparsers/dist/',
-            'STATS_FILE': os.path.join(
-                static_root if static_root else
-                os.path.join(
-                    BASE_DIR,
-                    'django_airavata',
-                    'apps',
-                    'dataparsers',
-                    'static',
-                ),
-                'django_airavata_dataparsers',
-                'dist',
-                'webpack-stats.json'),
-        },
-        'GROUPS': {
-            'BUNDLE_DIR_NAME': 'django_airavata_groups/dist/',
-            'STATS_FILE': os.path.join(
-                static_root if static_root else
-                os.path.join(
-                    BASE_DIR,
-                    'django_airavata',
-                    'apps',
-                    'groups',
-                    'static',
-                ),
-                'django_airavata_groups',
-                'dist',
-                'webpack-stats.json'),
-        },
-        'WORKSPACE': {
-            'BUNDLE_DIR_NAME': 'django_airavata_workspace/dist/',
-            'STATS_FILE': os.path.join(
-                static_root if static_root else
-                os.path.join(
-                    BASE_DIR,
-                    'django_airavata',
-                    'apps',
-                    'workspace',
-                    'static',
-                ),
-                'django_airavata_workspace',
-                'dist',
-                'webpack-stats.json'),
-        },
-    }
diff --git a/docs/dev/new_django_app.md b/docs/dev/new_django_app.md
index e8b289c..f17d465 100644
--- a/docs/dev/new_django_app.md
+++ b/docs/dev/new_django_app.md
@@ -92,21 +92,18 @@ INSTALLED_APPS = [
 ### Add Webpack bundle loader config to settings.py
 
 If the new app has Webpack built frontend, then add the following configuration
-to webpack_loader_util.py:
+to WEBPACK_LOADER in settings.py:
 
 ```python
 ...
 'MYAPP': {
   'BUNDLE_DIR_NAME': 'django_airavata_myapp/dist/',
   'STATS_FILE': os.path.join(
-      static_root if static_root else
-      os.path.join(
-          BASE_DIR,
-          'django_airavata',
-          'apps',
-          'myapp',
-          'static',
-      ),
+      BASE_DIR,
+      'django_airavata',
+      'apps',
+      'myapp',
+      'static',
       'django_airavata_myapp',
       'dist',
       'webpack-stats.json'),


Mime
View raw message