production
djangomain.settings.production
Attributes
ACCESS_TOKEN_LIFETIME_IN_SECONDS = 2 * 60 * 60
module-attribute
ALLOWED_HOSTS = os.environ['ALLOWED_HOSTS'].split(',')
module-attribute
ANONYMOUS_USER_NAME = 'AnonymousUser'
module-attribute
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend')
module-attribute
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'}]
module-attribute
AUTH_USER_MODEL = 'management.User'
module-attribute
BASE_DIR = str(Path(__file__).resolve().parent.parent.parent)
module-attribute
BOOTSTRAP5 = dict(css_url=(dict(url=f'https://cdn.jsdelivr.net/npm/bootswatch{javascript_version}dist/flatly/bootstrap.min.css', integrity='sha384-Gn6TIhloBHiLpI1VM8qQG+H8QQhHXqsiUlMLS4uhr9gqQzFsOhMTo0lSTMbOrLoI', crossorigin='anonymous')))
module-attribute
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap5'
module-attribute
CRISPY_TEMPLATE_PACK = 'bootstrap5'
module-attribute
DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'postgres', 'USER': 'postgres', 'PASSWORD': 'postgres', 'HOST': 'db', 'PORT': '5432'}, 'huey': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'huey', 'FILE': os.path.join(BASE_DIR, 'data', 'huey.db')}}
module-attribute
DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800
module-attribute
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
module-attribute
DEBUG = False
module-attribute
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
module-attribute
DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap5.html'
module-attribute
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
module-attribute
EMAIL_HOST = '10.1.1.18'
module-attribute
EMAIL_PORT = 25
module-attribute
FILE_UPLOAD_MAX_MEMORY_SIZE = 27000000
module-attribute
FIXTURE_DIRS = [os.path.join(PROJECT_ROOT, 'utilities/data')]
module-attribute
HUEY = {'huey_class': 'huey.SqliteHuey', 'name': DATABASES['huey']['NAME'], 'immediate': False, 'consumer': {'workers': 2}, 'connection': {'filename': DATABASES['huey']['FILE']}}
module-attribute
IMPORT_BATCH_SIZE = 10000
module-attribute
INSTALLED_APPS = ['station.apps.StationConfig', 'sensor.apps.SensorConfig', 'variable.apps.VariableConfig', 'formatting.apps.FormattingConfig', 'measurement', 'importing.apps.ImportingConfig', 'django_bootstrap5', 'django_extensions', 'django_filters', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'huey.contrib.djhuey', 'rest_framework', 'rest_framework_simplejwt', 'drf_spectacular', 'management', 'crispy_forms', 'crispy_bootstrap5', 'django_plotly_dash.apps.DjangoPlotlyDashConfig', 'guardian', 'django_tables2']
module-attribute
INTERNAL_IPS = ('127.0.0.1',)
module-attribute
LANGUAGE_CODE = 'en-gb'
module-attribute
LOGIN_REDIRECT_URL = 'home'
module-attribute
LOGIN_URL = 'auth:login'
module-attribute
LOGOUT_REDIRECT_URL = '/'
module-attribute
MAX_LAYER_FILE_SIZE_MB = 100
module-attribute
MAX_POINTS = 1000
module-attribute
MEDIA_ROOT = os.path.join(BASE_DIR, 'data/media')
module-attribute
MEDIA_URL = '/media/'
module-attribute
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', 'django_plotly_dash.middleware.BaseMiddleware', 'djangomain.middleware.TimezoneMiddleware']
module-attribute
PLOTLY_COMPONENTS = ['dpd_components']
module-attribute
PROJECT_ROOT = str(Path(__file__).resolve().parent.parent.parent)
module-attribute
REST_AUTH_SERIALIZERS = {'USER_DETAILS_SERIALIZER': 'management.serializers.UserSerializer'}
module-attribute
REST_FRAMEWORK = {'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 100, 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], 'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.IsAuthenticated'], 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', 'DEFAULT_AUTHENTICATION_CLASSES': ['rest_framework_simplejwt.authentication.JWTAuthentication', 'rest_framework.authentication.SessionAuthentication'], 'DEFAULT_RENDERER_CLASSES': ['rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer']}
module-attribute
ROOT_URLCONF = 'djangomain.urls'
module-attribute
SECRET_KEY = os.environ['SECRET_KEY']
module-attribute
SECURE_BROWSER_XSS_FILTER = True
module-attribute
SECURE_HSTS_SECONDS = 15552000
module-attribute
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
module-attribute
SIMPLE_JWT = {'ACCESS_TOKEN_LIFETIME': timedelta(seconds=ACCESS_TOKEN_LIFETIME_IN_SECONDS), 'REFRESH_TOKEN_LIFETIME': timedelta(days=3650), 'ROTATE_REFRESH_TOKENS': True, 'BLACKLIST_AFTER_ROTATION': False, 'ALGORITHM': 'HS256', 'SIGNING_KEY': SECRET_KEY, 'VERIFYING_KEY': None, 'AUTH_HEADER_TYPES': ('Bearer',), 'USER_ID_FIELD': 'id', 'USER_ID_CLAIM': 'user_id', 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',)}
module-attribute
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
module-attribute
SPECTACULAR_SETTINGS = {'TITLE': 'Paricia API', 'DESCRIPTION': 'API for the Paricia hydrological monitoring platform (iMHEA)', 'VERSION': '1.0.0', 'SERVE_INCLUDE_SCHEMA': False, 'COMPONENT_SPLIT_REQUEST': True, 'SERVERS': [{'url': 'http://localhost:8000', 'description': os.environ.get('API_SERVER_DESCRIPTION', 'Local Development server')}], 'TAGS': [{'name': 'stations', 'description': 'Station operations'}, {'name': 'measurements', 'description': 'Measurement data download operations'}, {'name': 'variables', 'description': 'Variable operations'}, {'name': 'sensors', 'description': 'Sensor operations'}, {'name': 'importing', 'description': 'Data import operations'}, {'name': 'formatting', 'description': 'Data formatting operations'}], 'PREPROCESSING_HOOKS': ['drf_spectacular.hooks.preprocess_exclude_path_format']}
module-attribute
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
module-attribute
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django_plotly_dash.finders.DashAssetFinder', 'django_plotly_dash.finders.DashComponentFinder', 'django_plotly_dash.finders.DashAppDirectoryFinder']
module-attribute
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
module-attribute
STATIC_URL = '/static/'
module-attribute
TB_CUSTOMER_DEVICES_URL = f'https://{TB_HOST}/api/customer/{customer_id}/devices?pageSize=10000&page=0'
module-attribute
TB_HOST = os.getenv('TB_HOST')
module-attribute
TB_TIMESERIES_URL = f'https://{TB_HOST}/api/plugins/telemetry/DEVICE/{tb_device_id}/values/timeseries'
module-attribute
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], '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']}}]
module-attribute
THINGSBOARD_REQUEST_TIMEOUT = 60
module-attribute
TIME_ZONE = 'UTC'
module-attribute
WSGI_APPLICATION = 'djangomain.wsgi.application'
module-attribute
X_FRAME_OPTIONS = 'SAMEORIGIN'
module-attribute
javascript_url = BOOTSTRAP5_DEFAULTS['javascript_url']['url']
module-attribute
javascript_version = javascript_url[slice(*(match.span()))]
module-attribute