Advertisement
Guest User

Untitled

a guest
Oct 10th, 2022
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. """
  2. Django settings for ecommerce project.
  3.  
  4. Generated by 'django-admin startproject' using Django 3.2.
  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.  
  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/3.2/howto/deployment/checklist/
  21.  
  22. # SECURITY WARNING: keep the secret key used in production secret!
  23.  
  24.  
  25. # SECURITY WARNING: don't run with debug turned on in production!
  26. DEBUG = True
  27.  
  28. ALLOWED_HOSTS = ["*"]
  29.  
  30. # EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  31.  
  32. # Application definition
  33.  
  34. INSTALLED_APPS = [
  35. 'core.apps.CoreConfig',
  36. 'django.contrib.admin',
  37. 'django.contrib.auth',
  38. 'django.contrib.contenttypes',
  39. 'django.contrib.sessions',
  40. 'django.contrib.messages',
  41. 'django.contrib.staticfiles',
  42. 'corsheaders',
  43. ]
  44.  
  45. MIDDLEWARE = [
  46. 'django.middleware.security.SecurityMiddleware',
  47. "corsheaders.middleware.CorsMiddleware",
  48. 'django.contrib.sessions.middleware.SessionMiddleware',
  49. 'django.middleware.common.CommonMiddleware',
  50. 'django.middleware.csrf.CsrfViewMiddleware',
  51. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  52. 'django.contrib.messages.middleware.MessageMiddleware',
  53. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  54. 'whitenoise.middleware.WhiteNoiseMiddleware',
  55. ]
  56.  
  57. ROOT_URLCONF = 'ecommerce.urls'
  58.  
  59. TEMPLATES = [
  60. {
  61. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  62. 'DIRS': [],
  63. 'APP_DIRS': True,
  64. 'OPTIONS': {
  65. 'context_processors': [
  66. 'django.template.context_processors.debug',
  67. 'django.template.context_processors.request',
  68. 'django.contrib.auth.context_processors.auth',
  69. 'django.contrib.messages.context_processors.messages',
  70. ],
  71. },
  72. },
  73. ]
  74.  
  75. WSGI_APPLICATION = 'ecommerce.wsgi.application'
  76.  
  77.  
  78. # Database
  79. # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
  80.  
  81. DATABASES = {
  82. 'default': {
  83. 'ENGINE': 'django.db.backends.mysql',
  84. #database stuff here
  85. 'CONN_MAX_AGE': None,
  86. }
  87. }
  88.  
  89.  
  90. # Password validation
  91. # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
  92.  
  93. AUTH_PASSWORD_VALIDATORS = [
  94. {
  95. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  96. },
  97. {
  98. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  99. },
  100. {
  101. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  102. },
  103. {
  104. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  105. },
  106. ]
  107.  
  108.  
  109. # Internationalization
  110. # https://docs.djangoproject.com/en/3.2/topics/i18n/
  111.  
  112. LANGUAGE_CODE = 'en-us'
  113.  
  114. TIME_ZONE = 'UTC'
  115.  
  116. USE_I18N = True
  117.  
  118. USE_L10N = True
  119.  
  120. USE_TZ = True
  121.  
  122.  
  123. # Static files (CSS, JavaScript, Images)
  124. # https://docs.djangoproject.com/en/3.2/howto/static-files/
  125.  
  126. STATIC_URL = '/static/'
  127.  
  128. # Default primary key field type
  129. # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
  130.  
  131. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  132.  
  133. CORS_ALLOW_ALL_ORIGINS = True
  134. CSRF_TRUSTED_ORIGINS = ['https://theherokuweb.herokuapp.com','http://theherokuweb.herokuapp.com','http://localhost:3000','https://*.127.0.0.1']
  135.  
  136.  
  137. REST_FRAMEWORK = {
  138. 'DEFAULT_AUTHENTICATED_CLASSES': [
  139. 'rest_framework.authenticated.SessionAuthentication',
  140. ]
  141. }
  142.  
  143. CSRF_COOKIE_SAMESITE = 'Lax'
  144. SESSION_COOKIE_SAMESITE = 'Lax'
  145. # CSRF_COOKIE_HTTPONLY = True
  146. # SESSION_COOKIE_HTTPONLY = True
  147.  
  148. # PROD ONLY
  149. # CSRF_COOKIE_SECURE = True
  150. # SESSION_COOKIE_SECURE = True
  151.  
  152. CORS_EXPOSE_HEADERS = ['Content-Type', 'X-CSRFToken']
  153. CORS_ALLOW_CREDENTIALS = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement