Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion app/app/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path
import os
import environ
from datetime import timedelta

BASE_DIR = Path(__file__).resolve().parent.parent

Expand All @@ -13,7 +14,7 @@

SECRET_KEY = env('SECRET_KEY')

ALLOWED_HOSTS = []
ALLOWED_HOSTS = env('ALLOWED_HOSTS').split(',')


# Application definition
Expand All @@ -26,6 +27,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'django_createsuperuser',
'rest_framework',
'corsheaders',
'drf_yasg',

Expand Down Expand Up @@ -69,6 +71,10 @@
}

AUTH_USER_MODEL = 'users.User'
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
]


AUTH_PASSWORD_VALIDATORS = [
{
Expand Down Expand Up @@ -101,3 +107,35 @@

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True

REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': (
'django_filters.rest_framework.DjangoFilterBackend',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
)
}

JWT_AUTH = {
'JWT_EXPIRATION_DELTA': timedelta(days=14),
'JWT_REFRESH_EXPIRATION_DELTA': timedelta(days=21),
'JWT_ALLOW_REFRESH': True,
}

SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'Bearer': {
'type': 'apiKey',
'name': 'Authorization',
'in': 'header'
}
}
}

USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')