settings.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. """
  2. Django settings for healthdiarybackend project.
  3. Generated by 'django-admin startproject' using Django 3.0.8.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/3.0/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/3.0/ref/settings/
  8. """
  9. import os
  10. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  11. from django.conf.global_settings import gettext_noop
  12. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  13. # Quick-start development settings - unsuitable for production
  14. # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = '=k2@yms-r0i866a&&1858t(qq=$t)55z-ae3h-gpjdmw5g$l12'
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = True
  19. ALLOWED_HOSTS = [
  20. '*',
  21. ]
  22. # Application definition
  23. INSTALLED_APPS = [
  24. 'django.contrib.admin',
  25. 'django.contrib.auth',
  26. 'django.contrib.contenttypes',
  27. 'django.contrib.sessions',
  28. 'django.contrib.messages',
  29. 'django.contrib.staticfiles',
  30. 'rest_framework',
  31. 'rest_framework.authtoken',
  32. 'apps.patient',
  33. 'apps.indicatortype',
  34. ]
  35. MIDDLEWARE = [
  36. 'django.middleware.security.SecurityMiddleware',
  37. 'django.contrib.sessions.middleware.SessionMiddleware',
  38. 'django.middleware.common.CommonMiddleware',
  39. 'django.middleware.csrf.CsrfViewMiddleware',
  40. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  41. 'django.contrib.messages.middleware.MessageMiddleware',
  42. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  43. ]
  44. ROOT_URLCONF = 'healthdiarybackend.urls'
  45. TEMPLATES = [
  46. {
  47. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  48. 'DIRS': [],
  49. 'APP_DIRS': True,
  50. 'OPTIONS': {
  51. 'context_processors': [
  52. 'django.template.context_processors.debug',
  53. 'django.template.context_processors.request',
  54. 'django.contrib.auth.context_processors.auth',
  55. 'django.contrib.messages.context_processors.messages',
  56. ],
  57. },
  58. },
  59. ]
  60. WSGI_APPLICATION = 'healthdiarybackend.wsgi.application'
  61. # Database
  62. # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
  63. DATABASES = {
  64. 'default': {
  65. 'ENGINE': 'django.db.backends.sqlite3',
  66. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  67. }
  68. }
  69. # Password validation
  70. # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
  71. AUTH_PASSWORD_VALIDATORS = [
  72. {
  73. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  74. },
  75. {
  76. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  77. },
  78. # {
  79. # 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  80. # },
  81. {
  82. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  83. },
  84. ]
  85. # Internationalization
  86. # https://docs.djangoproject.com/en/3.0/topics/i18n/
  87. LANGUAGE_CODE = 'en'
  88. TIME_ZONE = 'Europe/Moscow'
  89. USE_I18N = True
  90. USE_L10N = True
  91. USE_TZ = True
  92. # Languages we provide translations for, out of the box.
  93. # LANGUAGES = [
  94. # ('ru', gettext_noop('Russian')),
  95. # ]
  96. # Static files (CSS, JavaScript, Images)
  97. # https://docs.djangoproject.com/en/3.0/howto/static-files/
  98. STATIC_URL = '/static/'
  99. REST_FRAMEWORK = {
  100. 'DEFAULT_AUTHENTICATION_CLASSES': [
  101. 'rest_framework.authentication.BasicAuthentication',
  102. # 'rest_framework.authentication.SessionAuthentication',
  103. 'rest_framework.authentication.TokenAuthentication',
  104. ],
  105. 'DEFAULT_PERMISSION_CLASSES': [
  106. 'rest_framework.permissions.IsAuthenticated',
  107. ]
  108. }