|
| 1 | +""" |
| 2 | +Django settings for core project. |
| 3 | +
|
| 4 | +Generated by 'django-admin startproject' using Django 3.2.4. |
| 5 | +
|
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/3.2/topics/settings/ |
| 8 | +
|
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/3.2/ref/settings/ |
| 11 | +""" |
| 12 | + |
| 13 | +from pathlib import Path |
| 14 | +import graphene_django |
| 15 | + |
| 16 | +# Build paths inside the project like this: BASE_DIR / 'subdir'. |
| 17 | +BASE_DIR = Path(__file__).resolve().parent.parent |
| 18 | + |
| 19 | + |
| 20 | +# Quick-start development settings - unsuitable for production |
| 21 | +# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ |
| 22 | + |
| 23 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 24 | +SECRET_KEY = 'django-insecure-w$!%w@p3gz-yrgbw=9*_8vsy1&6&y3j#=@co2dxr6zbkayww3q' |
| 25 | + |
| 26 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 27 | +DEBUG = True |
| 28 | + |
| 29 | +ALLOWED_HOSTS = [] |
| 30 | + |
| 31 | + |
| 32 | +# Application definition |
| 33 | + |
| 34 | +INSTALLED_APPS = [ |
| 35 | + 'django.contrib.admin', |
| 36 | + 'django.contrib.auth', |
| 37 | + 'django.contrib.contenttypes', |
| 38 | + 'django.contrib.sessions', |
| 39 | + 'django.contrib.messages', |
| 40 | + 'django.contrib.staticfiles', |
| 41 | + 'users', |
| 42 | + 'graphene_django', |
| 43 | + 'graphql_jwt.refresh_token.apps.RefreshTokenConfig', |
| 44 | + 'graphql_auth', |
| 45 | + 'django_filters', |
| 46 | + |
| 47 | +] |
| 48 | + |
| 49 | +MIDDLEWARE = [ |
| 50 | + 'django.middleware.security.SecurityMiddleware', |
| 51 | + 'django.contrib.sessions.middleware.SessionMiddleware', |
| 52 | + 'django.middleware.common.CommonMiddleware', |
| 53 | + 'django.middleware.csrf.CsrfViewMiddleware', |
| 54 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 55 | + 'django.contrib.messages.middleware.MessageMiddleware', |
| 56 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 57 | +] |
| 58 | + |
| 59 | +ROOT_URLCONF = 'core.urls' |
| 60 | + |
| 61 | +TEMPLATES = [ |
| 62 | + { |
| 63 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 64 | + 'DIRS': [], |
| 65 | + 'APP_DIRS': True, |
| 66 | + 'OPTIONS': { |
| 67 | + 'context_processors': [ |
| 68 | + 'django.template.context_processors.debug', |
| 69 | + 'django.template.context_processors.request', |
| 70 | + 'django.contrib.auth.context_processors.auth', |
| 71 | + 'django.contrib.messages.context_processors.messages', |
| 72 | + ], |
| 73 | + }, |
| 74 | + }, |
| 75 | +] |
| 76 | + |
| 77 | +WSGI_APPLICATION = 'core.wsgi.application' |
| 78 | + |
| 79 | + |
| 80 | +# Database |
| 81 | +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases |
| 82 | + |
| 83 | +DATABASES = { |
| 84 | + 'default': { |
| 85 | + 'ENGINE': 'django.db.backends.sqlite3', |
| 86 | + 'NAME': BASE_DIR / 'db.sqlite3', |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | + |
| 91 | +# Password validation |
| 92 | +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators |
| 93 | + |
| 94 | +AUTH_PASSWORD_VALIDATORS = [ |
| 95 | + { |
| 96 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 97 | + }, |
| 98 | + { |
| 99 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 100 | + }, |
| 101 | + { |
| 102 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 103 | + }, |
| 104 | + { |
| 105 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 106 | + }, |
| 107 | +] |
| 108 | + |
| 109 | + |
| 110 | +# Internationalization |
| 111 | +# https://docs.djangoproject.com/en/3.2/topics/i18n/ |
| 112 | + |
| 113 | +LANGUAGE_CODE = 'en-us' |
| 114 | + |
| 115 | +TIME_ZONE = 'UTC' |
| 116 | + |
| 117 | +USE_I18N = True |
| 118 | + |
| 119 | +USE_L10N = True |
| 120 | + |
| 121 | +USE_TZ = True |
| 122 | + |
| 123 | + |
| 124 | +# Static files (CSS, JavaScript, Images) |
| 125 | +# https://docs.djangoproject.com/en/3.2/howto/static-files/ |
| 126 | + |
| 127 | +STATIC_URL = '/static/' |
| 128 | + |
| 129 | +AUTH_USER_MODEL = 'users.ExtendUser' |
| 130 | + |
| 131 | +GRAPHENE = { |
| 132 | + 'SCHEMA': 'users.schema.schema', |
| 133 | + 'MIDDLEWARE': [ |
| 134 | + 'graphql_jwt.middleware.JSONWebTokenMiddleware', |
| 135 | + ], |
| 136 | + |
| 137 | +} |
| 138 | + |
| 139 | + |
| 140 | +AUTHENTICATION_BACKENDS = [ |
| 141 | + ##'graphql_jwt.backends.JSONWebTokenBackend', |
| 142 | + 'graphql_auth.backends.GraphQLAuthBackend', |
| 143 | + 'django.contrib.auth.backends.ModelBackend', |
| 144 | +] |
| 145 | + |
| 146 | +GRAPHQL_JWT = { |
| 147 | + "JWT_ALLOW_ANY_CLASSES": [ |
| 148 | + "graphql_auth.mutations.Register", |
| 149 | + "graphql_auth.mutations.VerifyAccount", |
| 150 | + "graphql_auth.mutations.ObtainJSOWebToken", |
| 151 | + ], |
| 152 | + "JWT_VERIFY_EXPIRATION": True, |
| 153 | + "JWT_LONG_RUNNING_REFRESH_TOKEN": True, |
| 154 | + |
| 155 | +} |
| 156 | + |
| 157 | +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # for now not integreating with the other service |
| 158 | + |
| 159 | + |
| 160 | +# Default primary key field type |
| 161 | +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field |
| 162 | + |
| 163 | +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
| 164 | + |
| 165 | + |
| 166 | + |
0 commit comments