Roman_Sarnov

Untitled

Jun 19th, 2020
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. import os
  2.  
  3. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  4. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  5.  
  6. ALLOWED_HOSTS = ['localhost', '127.0.0.1']
  7.  
  8. # Application definition
  9.  
  10. INSTALLED_APPS = [
  11. 'django.contrib.admin',
  12. 'django.contrib.auth',
  13. 'django.contrib.contenttypes',
  14. 'django.contrib.sessions',
  15. 'django.contrib.messages',
  16. 'django.contrib.staticfiles',
  17. 'django.contrib.sites',
  18.  
  19. 'shop',
  20. 'favourites',
  21. 'customuser',
  22. 'contact',
  23. 'orders',
  24. 'cart',
  25.  
  26. 'social_django',
  27. 'debug_toolbar',
  28. ]
  29.  
  30.  
  31. MIDDLEWARE = [
  32. 'django.middleware.security.SecurityMiddleware',
  33. 'whitenoise.middleware.WhiteNoiseMiddleware',
  34. 'django.contrib.sessions.middleware.SessionMiddleware',
  35. 'django.middleware.common.CommonMiddleware',
  36. 'django.middleware.csrf.CsrfViewMiddleware',
  37. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  38. 'django.contrib.messages.middleware.MessageMiddleware',
  39. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  40. 'debug_toolbar.middleware.DebugToolbarMiddleware',
  41. ]
  42.  
  43. ROOT_URLCONF = 'flowers_shop.urls'
  44. import os
  45.  
  46. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  47.  
  48. SECRET_KEY = '3xw$wnvhaby0#(olv@o%-78r-w00@p1!k^v3@f23qy()cgenqn'
  49.  
  50. DEBUG = False
  51.  
  52. ALLOWED_HOSTS = ['localhost', '127.0.0.1']
  53.  
  54. DATABASES = {
  55. 'default': {
  56. 'ENGINE': 'django.db.backends.sqlite3',
  57. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  58. }
  59. }
  60.  
  61.  
  62. TEMPLATES = [
  63. {
  64. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  65. 'DIRS': [os.path.join(BASE_DIR, 'templates')],
  66. 'APP_DIRS': True,
  67. 'OPTIONS': {
  68. 'context_processors': [
  69. 'django.template.context_processors.debug',
  70. 'django.template.context_processors.request',
  71. 'django.contrib.auth.context_processors.auth',
  72. 'django.contrib.messages.context_processors.messages',
  73. 'social_django.context_processors.backends',
  74. ],
  75. },
  76. },
  77. ]
  78.  
  79. WSGI_APPLICATION = 'flowers_shop.wsgi.application'
  80.  
  81. # Database
  82. # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
  83.  
  84.  
  85. # Password validation
  86. # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
  87.  
  88. AUTH_PASSWORD_VALIDATORS = [
  89. {
  90. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  91. },
  92. {
  93. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  94. },
  95. {
  96. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  97. },
  98. {
  99. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  100. },
  101. ]
  102.  
  103. # Internationalization
  104. # https://docs.djangoproject.com/en/3.0/topics/i18n/
  105.  
  106. LANGUAGE_CODE = 'en-us'
  107.  
  108. TIME_ZONE = 'UTC'
  109.  
  110. USE_I18N = True
  111.  
  112. USE_L10N = True
  113.  
  114. USE_TZ = True
  115.  
  116. # Static files (CSS, JavaScript, Images)
  117. # https://docs.djangoproject.com/en/3.0/howto/static-files/
  118. STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  119. STATIC_URL = '/static/'
  120. MEDIA_URL = '/media/'
  121. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  122. AUTH_USER_MODEL = 'customuser.CustomUser'
  123.  
  124. CELERY_BROKER_URL = 'redis://localhost:6379'
  125. CELERY_RESULT_BACKEND = 'redis://localhost:6379'
  126. CELERY_ACCEPT_CONTENT = ['application/json']
  127. CELERY_RESULT_SERIALIZER = 'json'
  128. CELERY_TASK_SERIALIZER = 'json'
  129.  
  130. EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  131. EMAIL_USE_TLS = True
  132. EMAIL_HOST = 'smtp.gmail.com'
  133. EMAIL_HOST_USER = 'romansashaproject@gmail.com'
  134. EMAIL_HOST_PASSWORD = 'adminadmin12345'
  135. EMAIL_PORT = 587
  136.  
  137.  
  138. LOGIN_URL = 'login'
  139. LOGIN_REDIRECT_URL = 'shop'
  140. LOGOUT_URL = 'logout'
  141. LOGOUT_REDIRECT_URL = 'login'
  142.  
  143. SITE_ID = 1
  144.  
  145. AUTHENTICATION_BACKENDS = [
  146. 'django.contrib.auth.backends.ModelBackend',
  147. 'customuser.authentication.EmailAuthBackend',
  148. 'social_core.backends.vk.VKOAuth2',
  149. 'social_core.backends.google.GoogleOAuth2',
  150. 'social_core.backends.facebook.FacebookOAuth2',
  151. ]
  152.  
  153. SOCIAL_AUTH_VK_OAUTH2_KEY = '7495940' # VK App id
  154. SOCIAL_AUTH_VK_OAUTH2_SECRET = 'JYjpA1jqsYpgoZ0GtJxx' # VK App Secret
  155. SOCIAL_AUTH_VK_OAUTH2_SCOPE = ['email']
  156.  
  157. SOCIAL_AUTH_FACEBOOK_KEY = '274540583911031' # Facebook App ID
  158. SOCIAL_AUTH_FACEBOOK_SECRET = '3f3e813f737a85f2bbaa821401380da9' # Facebook App Secret
  159. SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
  160.  
  161. DEBUG_TOOLBAR_PATCH_SETTINGS = False
  162. INTERNAL_IPS = ('127.0.0.1',)
Add Comment
Please, Sign In to add comment