Skip to content
Snippets Groups Projects
Commit e7faeaf8 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

add migration files

parent d1d8dac8
No related branches found
No related tags found
No related merge requests found
Pipeline #6990 passed
......@@ -55,8 +55,10 @@ DATABASES = {
# 'HOST': 'sdc.astron.nl',
# 'PORT': '5432',
# database runs in docker container
'NAME': 'atdb',
# database runs in docker container,
# HOST is the service name as specified in the docker-compose file
# 'NAME': 'atdb',
'NAME': 'atdbldv',
'HOST': 'atdb-ldv-db',
'PORT': '5432',
},
......
from atdb.settings.base import *
# Import production setting must remain False.
DEBUG = False
#####################################################
# These settings mainly deal with https.
# See http://django-secure.readthedocs.io/en/latest/middleware.html
# Check the warning and instructions with:
# (.env) atdb@/var/.../atdb ./manage.py check --deploy --settings=atdb.settings.prod
#####################################################
# Assume SSL is correctly set up.
SSL_ENABLED = False
if SSL_ENABLED:
# True: Django now checks that cookies are ONLY sent over SSL.
# https://docs.djangoproject.com/en/1.11/ref/settings/#session-cookie-secure
SESSION_COOKIE_SECURE = True
# True: Django now checks that csrf tokens are ONLY sent over SSL.
# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-secure
CSRF_COOKIE_SECURE = True
# True: Always redirect requests back to https (currently ignored as Nginx should enforces https).
# Alternatively, enable and add set SECURE_PROXY_SSL_HEADER.
SECURE_SSL_REDIRECT = False
# Setting this to a non-zero value, will default the client UA always to connect over https.
# Unclear how or if this possibly affects other *.astron.nl domains. Especially, if these do
# not support https whether this option then breaks those http-only locations.
# SECURE_HSTS_SECONDS = 31536000
# True: Enables a header that disables the UA from 'clever' automatic mime type sniffing.
# http://django-secure.readthedocs.io/en/latest/settings.html#secure-content-type-nosniff
# https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff
SECURE_CONTENT_TYPE_NOSNIFF = True
# True: Enables a header that tells the UA to switch on the XSS filter.
# http://django-secure.readthedocs.io/en/latest/middleware.html#x-xss-protection-1-mode-block
SECURE_BROWSER_XSS_FILTER = True
# Prevents the site from being deployed within a iframe.
# This prevent click-jacking attacks.
# See; https://docs.djangoproject.com/en/1.11/ref/clickjacking/
X_FRAME_OPTIONS = 'DENY'
#####################################################
ALTA_HOST = "https://alta.astron.nl/altapi"
ALTA_USER = "atdb_write"
ALTA_PASS = "7VVJruVn8W1n"
\ No newline at end of file
"""
Django settings for atdb project.
Generated by 'django-admin startproject' using Django 2.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'cie-((m#n$br$6l53yash45*2^mwuux*2u)bad5(0flx@krnj9'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'taskdatabase',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'django_filters'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'atdb.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'atdb.wsgi.application'
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
],
'DEFAULT_FILTER_BACKENDS': (
'django_filters.rest_framework.DjangoFilterBackend',
),
}
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'atdb_admin',
'PASSWORD': 'atdb123',
# database runs locally in postgres
'NAME': 'atdb_trunk',
'HOST': 'localhost',
'PORT': '',
# database runs on a virtual machine
# 'HOST': 'alta-sys-db.astron.nl',
# 'PORT': '5432',
# 'NAME': 'altadb'
},
}
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Logging
# https://docs.djangoproject.com/en/1.11/topics/logging/#configuring-logging
# The default configuration: https://github.com/django/django/blob/stable/1.11.x/django/utils/log.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'formatters': {
'my_formatter': {
'()': 'django.utils.log.ServerFormatter',
'format': '[%(asctime)s] %(message)s',
}
},
'handlers': {
'console': {
'level': 'INFO',
'filters': ['require_debug_true'],
'class': 'logging.StreamHandler',
},
'django.server': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'my_formatter',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'my_handler': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'my_formatter',
},
},
'loggers': {
'taskdatabase': {
'handlers': ['my_handler','mail_admins'],
'level': 'INFO',
},
'django': {
'handlers': ['console', 'mail_admins'],
'level': 'INFO',
},
'django.server': {
'handlers': ['django.server'],
'level': 'INFO',
'propagate': False,
},
}
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment