Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
193 lines (157 sloc) 4.62 KB
"""
Django settings for DFIRTrack project.
Generated by 'django-admin startproject' using Django 2.0.
"""
import os
# dfirtrack
GIRAF_URL = 'https://{{ giraf_fqdn }}'
GIRAF_USER = '{{ giraf_user }}'
GIRAF_PASS = '{{ giraf_pass }}'
LOGGING_PATH = '{{ log_dir }}'
MARKDOWN_PATH = '{{ markdown_dir }}/{{ markdown_proj }}'
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '{{ secret_key }}'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['{{ fqdn }}','localhost']
# Application definition
INSTALLED_APPS = [
'dfirtrack_main',
'dfirtrack_api',
'rest_framework',
'django_q',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.postgres',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
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 = 'dfirtrack.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 = 'dfirtrack.wsgi.application'
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '{{ postgresql_database }}',
'USER': '{{ postgresql_user }}',
'PASSWORD': '{{ postgresql_user_password }}',
'HOST': 'localhost',
'PORT': '',
}
}
# Password validation
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
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATIC_ROOT = '{{ www_dir }}/static/'
LOGIN_REDIRECT_URL = '/systems'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'std_formatter': {
'format': '[%(asctime)s] %(levelname)s %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
},
},
'handlers': {
'request': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': LOGGING_PATH + '/' + 'django_request.log',
'formatter': 'std_formatter',
},
'database': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': LOGGING_PATH + '/' + 'django_database.log',
'formatter': 'std_formatter',
},
'customlog': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': LOGGING_PATH + '/' + 'dfirtrack.log',
'formatter': 'std_formatter',
},
},
'loggers': {
'django': {
'handlers': ['request'],
'level': 'INFO',
'propagate': True,
},
'django.db.backends': {
'handlers': ['database'],
'level': 'DEBUG',
'propagate': True,
},
'dfirtrack_main': {
'handlers': ['customlog'],
'level': 'INFO',
'propagate': True,
},
},
}
Q_CLUSTER = {
'name': 'dfirtrack',
'workers': 4,
'orm': 'default',
'label': 'Django Q',
#'sync': True,
}
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES' : [
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
],
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
}