|
| 1 | +""" |
| 2 | +Django settings for jarvis project. |
| 3 | +
|
| 4 | +Generated by 'django-admin startproject' using Django 5.0.1. |
| 5 | +
|
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/5.0/topics/settings/ |
| 8 | +
|
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/5.0/ref/settings/ |
| 11 | +""" |
| 12 | + |
| 13 | +from pathlib import Path |
| 14 | + |
| 15 | +# Build paths inside the project like this: BASE_DIR / 'subdir'. |
| 16 | +BASE_DIR = Path(__file__).resolve().parent.parent |
| 17 | + |
| 18 | + |
| 19 | +# Quick-start development settings - unsuitable for production |
| 20 | +# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ |
| 21 | + |
| 22 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 23 | +SECRET_KEY = 'django-insecure-ql)(+xkzabkw*896vf#i9rjr0ga^&uiz1z)t@hk659!h4c(8d1' |
| 24 | + |
| 25 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 26 | +DEBUG = False |
| 27 | + |
| 28 | +ALLOWED_HOSTS = ["*"] |
| 29 | + |
| 30 | +SITE_ID = 3 |
| 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 | + |
| 42 | + #?---------------------- Custom apps ----------------------?# |
| 43 | + 'jarvisapp', |
| 44 | + 'allauth', |
| 45 | + 'allauth.account', |
| 46 | + 'django.contrib.sites', |
| 47 | + 'allauth.socialaccount', |
| 48 | + 'allauth.socialaccount.providers.google', |
| 49 | + 'allauth.socialaccount.providers.github', # new for GitHub provider |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +] |
| 56 | + |
| 57 | + |
| 58 | +MIDDLEWARE = [ |
| 59 | + 'django.middleware.security.SecurityMiddleware', |
| 60 | + 'django.contrib.sessions.middleware.SessionMiddleware', |
| 61 | + 'django.middleware.common.CommonMiddleware', |
| 62 | + 'allauth.account.middleware.AccountMiddleware', |
| 63 | + 'django.middleware.csrf.CsrfViewMiddleware', |
| 64 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 65 | + 'django.contrib.messages.middleware.MessageMiddleware', |
| 66 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 67 | +] |
| 68 | + |
| 69 | +AUTHENTICATION_BACKENDS = ( |
| 70 | + 'django.contrib.auth.backends.ModelBackend', |
| 71 | + 'allauth.account.auth_backends.AuthenticationBackend', |
| 72 | +) |
| 73 | + |
| 74 | +SOCIALACCOUNT_PROVIDERS = { |
| 75 | + "google": { |
| 76 | + "SCOPE": ["profile", "email"], |
| 77 | + "AUTH_PARAMS": { |
| 78 | + "access_type": "online", |
| 79 | + }, |
| 80 | + 'APP': { |
| 81 | + 'key': '' |
| 82 | + } |
| 83 | + }, |
| 84 | + 'github': { |
| 85 | + 'SCOPE': ['user'], |
| 86 | + 'AUTH_PARAMS': { |
| 87 | + 'scope': 'user:email', |
| 88 | + }, |
| 89 | + 'APP': { |
| 90 | + 'key': '' |
| 91 | + } |
| 92 | + } |
| 93 | +} |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +LOGIN_REDIRECT_URL = "/" |
| 100 | +# LOGIN_REDIRECT_URL = "/" |
| 101 | + |
| 102 | +ACCOUNT_EMAIL_VERIFICATION = "none" # new |
| 103 | + |
| 104 | + |
| 105 | +# SOCIALACCOUNT_PROVIDERS = { |
| 106 | +# 'github': { |
| 107 | +# 'SCOPE': ['user'], |
| 108 | +# 'AUTH_PARAMS': { |
| 109 | +# 'scope': 'user:email', |
| 110 | +# }, |
| 111 | +# 'APP': { |
| 112 | +# 'client_id': '2489d6ef85b22cf62f52', |
| 113 | +# 'secret': 'f569cc7acdffe295964341fea7b6e13e922980e4', |
| 114 | +# 'key': '' |
| 115 | +# } |
| 116 | +# } |
| 117 | +# } |
| 118 | + |
| 119 | + |
| 120 | +import os |
| 121 | +ROOT_URLCONF = 'jarvis.urls' |
| 122 | + |
| 123 | +TEMPLATES = [ |
| 124 | + { |
| 125 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 126 | + 'DIRS': [os.path.join(BASE_DIR, 'templates')], |
| 127 | + 'APP_DIRS': True, |
| 128 | + 'OPTIONS': { |
| 129 | + 'context_processors': [ |
| 130 | + 'django.template.context_processors.debug', |
| 131 | + 'django.template.context_processors.request', |
| 132 | + 'django.contrib.auth.context_processors.auth', |
| 133 | + 'django.contrib.messages.context_processors.messages', |
| 134 | + ], |
| 135 | + }, |
| 136 | + }, |
| 137 | +] |
| 138 | + |
| 139 | +WSGI_APPLICATION = 'jarvis.wsgi.application' |
| 140 | + |
| 141 | + |
| 142 | +# Database |
| 143 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases |
| 144 | + |
| 145 | +DATABASES = { |
| 146 | + 'default': { |
| 147 | + 'ENGINE': 'django.db.backends.sqlite3', |
| 148 | + 'NAME': BASE_DIR / 'db.sqlite3', |
| 149 | + } |
| 150 | +} |
| 151 | + |
| 152 | + |
| 153 | +# Password validation |
| 154 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators |
| 155 | + |
| 156 | +AUTH_PASSWORD_VALIDATORS = [ |
| 157 | + { |
| 158 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 159 | + }, |
| 160 | + { |
| 161 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 162 | + }, |
| 163 | + { |
| 164 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 165 | + }, |
| 166 | + { |
| 167 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 168 | + }, |
| 169 | +] |
| 170 | + |
| 171 | + |
| 172 | +# Internationalization |
| 173 | +# https://docs.djangoproject.com/en/5.0/topics/i18n/ |
| 174 | + |
| 175 | +LANGUAGE_CODE = 'en-us' |
| 176 | + |
| 177 | +TIME_ZONE = 'UTC' |
| 178 | + |
| 179 | +USE_I18N = True |
| 180 | + |
| 181 | +USE_TZ = True |
| 182 | + |
| 183 | + |
| 184 | +# Static files (CSS, JavaScript, Images) |
| 185 | +# https://docs.djangoproject.com/en/5.0/howto/static-files/ |
| 186 | + |
| 187 | +STATIC_URL = 'static/' |
| 188 | + |
| 189 | +# Default primary key field type |
| 190 | +# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field |
| 191 | + |
| 192 | +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
| 193 | + |
| 194 | + |
| 195 | +#?-------------------------------------- Adiitional settings --------------------------------------?# |
| 196 | + |
| 197 | +#! --------------------- Static files directory -----------------------------------# |
| 198 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 199 | + |
| 200 | +STATICFILES_DIRS = [ |
| 201 | + os.path.join(BASE_DIR, 'static'), |
| 202 | + os.path.join(BASE_DIR, 'download_games') |
| 203 | +] |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | +#! --------------------- Sending email -----------------------------------# |
| 208 | + |
| 209 | +EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' |
| 210 | +EMAIL_HOST = 'smtp.gmail.com' |
| 211 | +EMAIL_PORT = 587 |
| 212 | +EMAIL_USE_TLS = True |
| 213 | +EMAIL_USE_SSL = False |
0 commit comments