Advertisement
Mochinov

Untitled

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