From f76e77dbdcfb4aeaf0f87d29359ada0494f0af2c Mon Sep 17 00:00:00 2001 From: Mattia Mancini <mancini@astron.nl> Date: Thu, 17 May 2018 17:08:43 +0000 Subject: [PATCH] Story SW-300: fixing all the project path to execute the django application using the files in lib [to adhere to the LOFAR standards] --- LCU/Maintenance/DBInterface/CMakeLists.txt | 12 ++++++++++-- .../DBInterface/django_postgresql/settings.py | 8 ++++---- .../DBInterface/django_postgresql/urls.py | 2 +- .../DBInterface/django_postgresql/wsgi.py | 2 +- LCU/Maintenance/DBInterface/manage.py | 3 ++- LCU/Maintenance/DBInterface/monitoringdb/apps.py | 2 +- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/LCU/Maintenance/DBInterface/CMakeLists.txt b/LCU/Maintenance/DBInterface/CMakeLists.txt index 5ecc5afb7fb..05dde07d104 100644 --- a/LCU/Maintenance/DBInterface/CMakeLists.txt +++ b/LCU/Maintenance/DBInterface/CMakeLists.txt @@ -2,7 +2,7 @@ lofar_package(DBInterface 1.0) -lofar_find_package(Python 2.6 REQUIRED) +lofar_find_package(Python 3.0 REQUIRED) include(PythonInstall) include(FindPythonModule) @@ -14,7 +14,15 @@ find_python_module(polymorphic REQUIRED) #sudo pip install django-re find_python_module(requests REQUIRED) find_python_module(pandas REQUIRED) - +# includes every python file excepts for the manage.py FILE(GLOB_RECURSE PY_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ./*.py) +LIST(REMOVE_ITEM PY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/manage.py) +foreach(LIST_ITEM ${PY_FILES}) + MESSAGE(STATUS ${LIST_ITEM}) +endforeach(LIST_ITEM ${PY_FILES}) + python_install(${PY_FILES} DESTINATION lofar/maintenance) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/manage.py + DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + diff --git a/LCU/Maintenance/DBInterface/django_postgresql/settings.py b/LCU/Maintenance/DBInterface/django_postgresql/settings.py index b3a08ab89fa..e1a9eb88616 100644 --- a/LCU/Maintenance/DBInterface/django_postgresql/settings.py +++ b/LCU/Maintenance/DBInterface/django_postgresql/settings.py @@ -24,7 +24,7 @@ SECRET_KEY = 'x)5=9*2a&)32h-loh@rlt_9eyw%t$-fqao*#1j2gh^7=^bnjyy' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['lofarmonitortest.control.lofar', 'localhost'] # Application definition @@ -37,7 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', - 'monitoringdb.apps.MonitoringDbConfig', + 'lofar.maintenance.monitoringdb.apps.MonitoringDbConfig', ] MIDDLEWARE = [ @@ -50,7 +50,7 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ROOT_URLCONF = 'django_postgresql.urls' +ROOT_URLCONF = 'lofar.maintenance.django_postgresql.urls' TEMPLATES = [ { @@ -68,7 +68,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = 'django_postgresql.wsgi.application' +WSGI_APPLICATION = 'lofar.maintenance.django_postgresql.wsgi.application' LOGGING = { 'version': 1, diff --git a/LCU/Maintenance/DBInterface/django_postgresql/urls.py b/LCU/Maintenance/DBInterface/django_postgresql/urls.py index 7c514cef5c5..ba621a8f1fe 100644 --- a/LCU/Maintenance/DBInterface/django_postgresql/urls.py +++ b/LCU/Maintenance/DBInterface/django_postgresql/urls.py @@ -17,7 +17,7 @@ from django.contrib import admin from django.conf.urls import url, include from rest_framework import routers -from monitoringdb import views +from lofar.maintenance.monitoringdb import views router = routers.DefaultRouter() router.register(r'stationtests', views.StationTestViewSet) diff --git a/LCU/Maintenance/DBInterface/django_postgresql/wsgi.py b/LCU/Maintenance/DBInterface/django_postgresql/wsgi.py index 575919a4e5b..72312d89bf5 100644 --- a/LCU/Maintenance/DBInterface/django_postgresql/wsgi.py +++ b/LCU/Maintenance/DBInterface/django_postgresql/wsgi.py @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_postgresql.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lofar.maintenance.django_postgresql.settings") application = get_wsgi_application() diff --git a/LCU/Maintenance/DBInterface/manage.py b/LCU/Maintenance/DBInterface/manage.py index 2977a4793aa..7980cd5320a 100755 --- a/LCU/Maintenance/DBInterface/manage.py +++ b/LCU/Maintenance/DBInterface/manage.py @@ -3,7 +3,8 @@ import os import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_postgresql.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", + "lofar.maintenance.django_postgresql.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/LCU/Maintenance/DBInterface/monitoringdb/apps.py b/LCU/Maintenance/DBInterface/monitoringdb/apps.py index 6840e929b7c..8c82ffcbed8 100644 --- a/LCU/Maintenance/DBInterface/monitoringdb/apps.py +++ b/LCU/Maintenance/DBInterface/monitoringdb/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class MonitoringDbConfig(AppConfig): - name = 'monitoringdb' + name = 'lofar.maintenance.monitoringdb' -- GitLab