From 89b47d3a1d5d494ce1325f219012c996866a64eb Mon Sep 17 00:00:00 2001
From: "Auke L. Klazema" <klazema@astron.nl>
Date: Tue, 1 Dec 2020 09:29:06 +0100
Subject: [PATCH] TMSS-477: Revert template and static file location

This does not work on dev machines but it does work for docker deployment.
A better solution needs to be found to work with both.
---
 SAS/TMSS/src/tmss/settings.py      | 4 ++--
 SAS/TMSS/src/tmss/tmssapp/views.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/SAS/TMSS/src/tmss/settings.py b/SAS/TMSS/src/tmss/settings.py
index 8bb7c8cd018..46acbc47faf 100644
--- a/SAS/TMSS/src/tmss/settings.py
+++ b/SAS/TMSS/src/tmss/settings.py
@@ -155,7 +155,7 @@ ROOT_URLCONF = 'lofar.sas.tmss.tmss.urls'
 TEMPLATES = [
     {
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
-        'DIRS': [BASE_DIR, os.path.join(BASE_DIR, 'templates'), os.path.join(os.environ.get('LOFARROOT'), 'lib64/python3.6/site-packages/lofar/sas/frontend','tmss_webapp')],
+        'DIRS': [BASE_DIR, os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, '../frontend','tmss_webapp')],
         'APP_DIRS': True,
         'OPTIONS': {
             'context_processors': [
@@ -169,7 +169,7 @@ TEMPLATES = [
 ]
 
 STATICFILES_DIRS = [
-    os.path.join(os.environ.get('LOFARROOT'), 'lib64/python3.6/site-packages/lofar/sas/frontend','tmss_webapp/build/static')
+    os.path.join(BASE_DIR, '../frontend','tmss_webapp/build/static')
 ]
 
 WSGI_APPLICATION = 'lofar.sas.tmss.tmss.wsgi.application'
diff --git a/SAS/TMSS/src/tmss/tmssapp/views.py b/SAS/TMSS/src/tmss/tmssapp/views.py
index 422c6aeb597..a7e0997c655 100644
--- a/SAS/TMSS/src/tmss/tmssapp/views.py
+++ b/SAS/TMSS/src/tmss/tmssapp/views.py
@@ -35,7 +35,7 @@ def subtask_parset(request, subtask_pk:int):
 
 
 def index(request):
-    return render(request, os.path.join(os.environ.get('LOFARROOT'), 'lib64/python3.6/site-packages/lofar/sas/frontend','tmss_webapp/build/index.html'))
+    return render(request, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), '../../frontend','tmss_webapp/build/index.html'))
     #return render(request, "../../../frontend/frontend_poc/build/index.html")
 
 
-- 
GitLab