Advertisement
Mochinov

Untitled

Jul 2nd, 2021
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.94 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. import os
  4. import datetime
  5.  
  6. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  7. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  8.  
  9. ASGI_APPLICATION = 'Doctor_at_home_team.routing.application'
  10.  
  11. # Quick-start development settings - unsuitable for production
  12. # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
  13.  
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = '9u^j-ex$@8ph2d#plq1nvzw@sf#&s#ul*5%w*vhe^-a%-4cl=)'
  16.  
  17. SECRET_KEY_AUTO_DAIL = '8TqIdnlP6NO35oF38Su1VgeJZYTDTpd7x5gZ'
  18. # SECURITY WARNING: don't run with debug turned on in production!
  19. DEBUG = False
  20.  
  21.  
  22. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  23.  
  24.  
  25. ALLOWED_HOSTS = ['*']
  26.  
  27. # Application definition
  28.  
  29. INSTALLED_APPS = [
  30. 'django.contrib.admin',
  31. 'django.contrib.auth',
  32. 'django.contrib.contenttypes',
  33. 'django.contrib.sessions',
  34. 'django.contrib.messages',
  35. 'django.contrib.staticfiles',
  36. 'ckeditor',
  37. 'channels',
  38. 'ckeditor_uploader',
  39. 'trekking',
  40. 'remote_connection',
  41. 'djoser',
  42. 'rest_framework',
  43. 'registration',
  44. 'dal',
  45. 'dal_select2',
  46. 'rest_framework_json_api',
  47. 'rest_framework_jwt',
  48. 'django_filters',
  49. 'rest_framework.authtoken',
  50. 'rest_api',
  51. 'account',
  52. 'netpay',
  53.  
  54. 'sslserver', # only for dev
  55. 'fontawesome-free',
  56. # 'silk' #SILK
  57. 'medicalaccount',
  58. ]
  59.  
  60. MIDDLEWARE = [
  61. 'django.middleware.security.SecurityMiddleware',
  62. 'django.contrib.sessions.middleware.SessionMiddleware',
  63. 'django.middleware.common.CommonMiddleware',
  64. # 'silk.middleware.SilkyMiddleware', # SILK
  65. 'django.middleware.csrf.CsrfViewMiddleware',
  66. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  67. 'django.contrib.messages.middleware.MessageMiddleware',
  68. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  69. ]
  70.  
  71. ROOT_URLCONF = 'Doctor_at_home_team.urls'
  72.  
  73. TEMPLATES = [
  74. {
  75. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  76. 'DIRS': [os.path.join(BASE_DIR, 'templates_team')],
  77. 'APP_DIRS': True,
  78. 'OPTIONS': {
  79. 'context_processors': [
  80. 'django.template.context_processors.debug',
  81. 'django.template.context_processors.request',
  82. 'django.contrib.auth.context_processors.auth',
  83. 'django.contrib.messages.context_processors.messages',
  84. ],
  85. },
  86. },
  87. ]
  88.  
  89. WSGI_APPLICATION = 'Doctor_at_home_team.wsgi.application'
  90.  
  91.  
  92. # Не использовать её !!!
  93. # DATABASES = {
  94. # 'default': {
  95. # 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  96. # 'NAME': 'elena',
  97. # 'HOST': '192.168.22.19',
  98. # 'PORT': '5432',
  99. # 'USER': 'elena',
  100. # 'PASSWORD': 'tktyf!@#4'
  101. # },
  102. # }
  103.  
  104.  
  105. AUTH_PASSWORD_VALIDATORS = [
  106. {
  107. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  108. },
  109. {
  110. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  111. },
  112. {
  113. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  114. },
  115. {
  116. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  117. },
  118. ]
  119.  
  120.  
  121. LANGUAGE_CODE = 'ru-ru'
  122.  
  123. TIME_ZONE = 'Europe/Moscow'
  124.  
  125. USE_I18N = True
  126.  
  127. USE_L10N = True
  128.  
  129. USE_TZ = False
  130.  
  131. STATIC_URL = '/static_team/'
  132. STATIC_ROOT = os.path.join(BASE_DIR, 'static_team/')
  133.  
  134. EMAIL_HOST = "smtp.gmail.com"
  135. EMAIL_PORT = 587
  136. EMAIL_HOST_USER = "noc@globalhome.su"
  137. EMAIL_HOST_PASSWORD = "yjr!@#"
  138. EMAIL_USE_TLS = True
  139.  
  140. SERVER_EMAIL = EMAIL_HOST_USER
  141. DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  142.  
  143. STATICFILES_DIRS = [
  144. os.path.join(BASE_DIR, "Doctor_at_home_team/static_team"),
  145. ]
  146.  
  147. AUTHENTICATION_BACKENDS = [
  148. "django.contrib.auth.backends.ModelBackend",
  149. "registration.authentication.EmailAuthBackend",
  150. ]
  151. REDIS_HOST = "127.0.0.1"
  152. REDIS_PORT = "6379"
  153.  
  154. MEDIA_URL = "/media/"
  155. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  156.  
  157. CKEDITOR_UPLOAD_PATH = "uploads/"
  158.  
  159. LOGIN_REDIRECT_URL = "/"
  160.  
  161. SECRET_KEY = "rujohf9472" # Секретный ключ для api 2 gis
  162.  
  163. REST_FRAMEWORK = {
  164. "DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.AllowAny",),
  165. "PAGE_SIZE": 10,
  166. "DEFAULT_AUTHENTICATION_CLASSES": (
  167. "rest_framework_jwt.authentication.JSONWebTokenAuthentication",
  168. "rest_framework.authentication.TokenAuthentication",
  169. "rest_framework_simplejwt.authentication.JWTAuthentication",
  170. "rest_framework.authentication.BasicAuthentication",
  171. "rest_framework.authentication.SessionAuthentication",
  172. ),
  173. "DEFAULT_PAGINATION_CLASS": "rest_framework_json_api.pagination.PageNumberPagination",
  174. "TEST_REQUEST_DEFAULT_FORMAT": "json",
  175. "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
  176. "DATETIME_FORMAT": "%d.%m.%Y %H:%M:%S",
  177. }
  178.  
  179.  
  180. JWT_AUTH = {
  181. "JWT_EXPIRATION_DELTA": datetime.timedelta(days=2),
  182. "JWT_ALLOW_REFRESH": True,
  183. "JWT_REFRESH_EXPIRATION_DELTA": datetime.timedelta(days=7), # default
  184. }
  185.  
  186. DJOSER = {
  187. "PASSWORD_RESET_CONFIRM_URL": "#/password/reset/confirm/{uid}/{token}",
  188. "USERNAME_RESET_CONFIRM_URL": "#/username/reset/confirm/{uid}/{token}",
  189. "ACTIVATION_URL": "#/activate/{uid}/{token}",
  190. "SEND_ACTIVATION_EMAIL": True,
  191. "SERIALIZERS": {},
  192. }
  193.  
  194.  
  195. SIMPLE_JWT = {
  196. "ACCESS_TOKEN_LIFETIME": datetime.timedelta(minutes=5),
  197. "REFRESH_TOKEN_LIFETIME": datetime.timedelta(days=1),
  198. "ROTATE_REFRESH_TOKENS": False,
  199. "BLACKLIST_AFTER_ROTATION": True,
  200. "ALGORITHM": "HS256",
  201. "SIGNING_KEY": SECRET_KEY,
  202. "VERIFYING_KEY": None,
  203. "AUDIENCE": None,
  204. "ISSUER": None,
  205. "AUTH_HEADER_TYPES": ("JWT",),
  206. "USER_ID_FIELD": "id",
  207. "USER_ID_CLAIM": "user_id",
  208. "AUTH_TOKEN_CLASSES": ("rest_framework_simplejwt.tokens.AccessToken",),
  209. "TOKEN_TYPE_CLAIM": "token_type",
  210. "JTI_CLAIM": "jti",
  211. "SLIDING_TOKEN_REFRESH_EXP_CLAIM": "refresh_exp",
  212. "SLIDING_TOKEN_LIFETIME": datetime.timedelta(minutes=5),
  213. "SLIDING_TOKEN_REFRESH_LIFETIME": datetime.timedelta(days=1),
  214. }
  215.  
  216. EMERGENCY_PHONES = {
  217. # '846': '78463077707',
  218. "499": "74996383003",
  219. "846": "78486250099",
  220. "999": "79992332322",
  221. }
  222.  
  223. CHANNEL_LAYERS = {
  224. 'default': {
  225. 'BACKEND': 'channels_redis.core.RedisChannelLayer',
  226. 'CONFIG': {
  227. "hosts": [(REDIS_HOST, REDIS_PORT)],
  228. },
  229. },
  230. }
  231.  
  232.  
  233. CACHES = {
  234. "default": {
  235. "BACKEND": "django_redis.cache.RedisCache",
  236. "LOCATION": "redis://127.0.0.1:6379",
  237. "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}
  238. }
  239. }
  240.  
  241. CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
  242. CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379"
  243. CELERY_ACCEPT_CONTENT = ['application/json']
  244. CELERY_TASK_SERIALIZER = 'json'
  245. CELERY_RESULT_SERIALIZER = 'json'
  246. CELERY_TIMEZONE = 'UTC'
  247. CELERY_TASK_TRACK_STARTED = True
  248.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement