diff options
Diffstat (limited to 'dashboard/src/pharos_dashboard')
-rw-r--r-- | dashboard/src/pharos_dashboard/celery.py | 2 | ||||
-rw-r--r-- | dashboard/src/pharos_dashboard/settings.py | 63 | ||||
-rw-r--r-- | dashboard/src/pharos_dashboard/urls.py | 11 |
3 files changed, 39 insertions, 37 deletions
diff --git a/dashboard/src/pharos_dashboard/celery.py b/dashboard/src/pharos_dashboard/celery.py index f60f243..2a44a3d 100644 --- a/dashboard/src/pharos_dashboard/celery.py +++ b/dashboard/src/pharos_dashboard/celery.py @@ -27,4 +27,4 @@ app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) @app.task(bind=True) def debug_task(self): - print('Request: {0!r}'.format(self.request))
\ No newline at end of file + print('Request: {0!r}'.format(self.request)) diff --git a/dashboard/src/pharos_dashboard/settings.py b/dashboard/src/pharos_dashboard/settings.py index 07e3920..86de78c 100644 --- a/dashboard/src/pharos_dashboard/settings.py +++ b/dashboard/src/pharos_dashboard/settings.py @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2018 Sawyer Bergeron and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## import os from datetime import timedelta @@ -8,15 +16,18 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # NOTE: os.environ only returns strings, so making a comparison to # 'True' here will convert it to the correct Boolean value. DEBUG = os.environ['DEBUG'] == 'True' +TESTING = os.environ['TEST'] == 'True' # Application definition INSTALLED_APPS = [ 'dashboard', + 'resource_inventory', 'booking', 'account', - 'jenkins', 'notifier', + 'workflow', + 'api', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -24,7 +35,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', - 'bootstrap3', + 'bootstrap4', 'crispy_forms', 'rest_framework', 'rest_framework.authtoken', @@ -46,11 +57,11 @@ ROOT_URLCONF = 'pharos_dashboard.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')] - , + 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ + 'dashboard.context_processors.debug', 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', @@ -60,6 +71,10 @@ TEMPLATES = [ }, ] +TEMPLATE_CONTEXT_PROCESSORS = [ + 'dashboard.context_processors.debug', +] + WSGI_APPLICATION = 'pharos_dashboard.wsgi.application' # Password validation @@ -128,13 +143,12 @@ DATABASES = { } } - # Rest API Settings REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' ], - 'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',), + 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.FilterSet',), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', @@ -165,42 +179,27 @@ OAUTH_CALLBACK_URL = os.environ['DASHBOARD_URL'] + '/accounts/authenticated' CELERY_TIMEZONE = 'UTC' RABBITMQ_URL = 'rabbitmq' -RABBITMQ_USER = os.environ['RABBITMQ_USER'] -RABBITMQ_PASSWORD = os.environ['RABBITMQ_PASSWORD'] +RABBITMQ_DEFAULT_USER = os.environ['RABBITMQ_DEFAULT_USER'] +RABBITMQ_DEFAULT_PASS = os.environ['RABBITMQ_DEFAULT_PASS'] -BROKER_URL = 'amqp://' + RABBITMQ_USER + ':' + RABBITMQ_PASSWORD + '@rabbitmq:5672//' - -BOOKING_EXP_TIME = os,environ['BOOKING_EXPIRE_TIME'] -BOOKING_MAX_NUM = os.environ['BOOKING_MAXIMUM_NUMBER'] +BROKER_URL = 'amqp://' + RABBITMQ_DEFAULT_USER + ':' + RABBITMQ_DEFAULT_PASS + '@rabbitmq:5672//' CELERYBEAT_SCHEDULE = { - 'sync-jenkins': { - 'task': 'jenkins.tasks.sync_jenkins', - 'schedule': timedelta(minutes=5) - }, - 'send-booking-notifications': { - 'task': 'notification.tasks.send_booking_notifications', - 'schedule': timedelta(minutes=5) - }, - 'clean-database': { - 'task': 'dashboard.tasks.database_cleanup', - 'schedule': timedelta(hours=24) + 'booking_poll': { + 'task': 'dashboard.tasks.booking_poll', + 'schedule': timedelta(minutes=1) }, - 'booking_cleanup': { - 'task': 'dashboard.tasks.booking_cleanup', - 'schedule': timedelta(hours=24) + 'free_hosts': { + 'task': 'dashboard.tasks.free_hosts', + 'schedule': timedelta(minutes=1) }, } -# Jenkins Settings -ALL_SLAVES_URL = os.environ['JENKINS_URL'] + '/computer/api/json?tree=computer[displayName,offline,idle]' -CI_SLAVES_URL = os.environ['JENKINS_URL'] + '/label/ci-pod/api/json?tree=nodes[nodeName,offline,idle]' -ALL_JOBS_URL = os.environ['JENKINS_URL'] + '/api/json?tree=jobs[displayName,url,lastBuild[fullDisplayName,building,builtOn,timestamp,result]' -GET_SLAVE_URL = os.environ['JENKINS_URL'] + '/computer/' # Notifier Settings EMAIL_HOST = os.environ['EMAIL_HOST'] EMAIL_PORT = os.environ['EMAIL_PORT'] EMAIL_HOST_USER = os.environ['EMAIL_HOST_USER'] EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD'] -EMAIL_USE_TLS=True +EMAIL_USE_TLS = True DEFAULT_EMAIL_FROM = os.environ.get('DEFAULT_EMAIL_FROM', 'webmaster@localhost') +SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" diff --git a/dashboard/src/pharos_dashboard/urls.py b/dashboard/src/pharos_dashboard/urls.py index adcb5b8..8535bed 100644 --- a/dashboard/src/pharos_dashboard/urls.py +++ b/dashboard/src/pharos_dashboard/urls.py @@ -1,5 +1,6 @@ ############################################################################## # Copyright (c) 2016 Max Breitenfeldt and others. +# Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -30,15 +31,17 @@ from django.contrib import admin urlpatterns = [ + + url(r'^wf/', include('workflow.urls', namespace='workflow')), url(r'^', include('dashboard.urls', namespace='dashboard')), url(r'^booking/', include('booking.urls', namespace='booking')), url(r'^accounts/', include('account.urls', namespace='account')), - + url(r'^resource/', include('resource_inventory.urls', namespace='resource')), url(r'^admin/', admin.site.urls), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), - - url(r'^api/', include('api.urls')) + url(r'^api/', include('api.urls')), + url(r'^messages/', include('notifier.urls', namespace='notifier')) ] if settings.DEBUG is True: - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
\ No newline at end of file + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |