
import os
import datetime


# Game settings
GAME_HAND_SIZE = 5
GAME_GUESS_SCORE = 3
GAME_STORY_SCORE = 3
GAME_CONFUSED_GUESS_SCORE = 1
GAME_MAX_ROUND_SCORE = 4
GAME_GOAL_SCORE = 21


DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, '../static')


# Folder with game card images
CARD_IMAGES_PATH = os.path.join(BASE_DIR, '../../cards')


SECRET_KEY = 'eo73+@(#4%a+uby-9!-_@$%wr%o047%rneii*bu@5nfl@k4t-!'
TOKEN_LENGTH = 16
ALLOWED_HOSTS = [
    '127.0.0.1',
    'localhost',
]


CORS_ORIGIN_WHITELIST = [
    'localhost:8000',
    'localhost:4200',
]


INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'corsheaders',
    'rest_framework',

    'dixit.account',
    'dixit.game',
    'dixit.api',
]


MIDDLEWARE_CLASSES = [
    'corsheaders.middleware.CorsMiddleware',

    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]


ROOT_URLCONF = 'dixit.urls'


TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(BASE_DIR, 'dixit/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',
            ],
        },
    },
]


WSGI_APPLICATION = 'dixit.wsgi.application'


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework.authentication.SessionAuthentication',
    ),
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework.renderers.JSONRenderer',
    ),
}

JWT_AUTH = {
    'JWT_EXPIRATION_DELTA': datetime.timedelta(hours=24),
}


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',
    },
]


LOGIN_REDIRECT_URL = r'/'


LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True


FIXTURE_DIRS = (
    os.path.join(BASE_DIR, 'dixit/fixtures'),
)


if DEBUG:
    del REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES']
    AUTH_PASSWORD_VALIDATORS = []

@@ -2683,16 +2683,56 @@
 rs=24),%0A
+    'JWT_AUTH_HEADER_PREFIX': 'Bearer',%0A
 %7D%0A%0A%0AAUTH

Use Bearer as authentication prefix