settings.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. """
  2. Django settings for mserv00 project.
  3. Generated by 'django-admin startproject' using Django 5.2.3.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/5.2/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/5.2/ref/settings/
  8. """
  9. from pathlib import Path
  10. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  11. BASE_DIR = Path(__file__).resolve().parent.parent
  12. # Quick-start development settings - unsuitable for production
  13. # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
  14. # SECURITY WARNING: keep the secret key used in production secret!
  15. SECRET_KEY = 'django-insecure-89&_=swo6&=@z714%#k6oo$ayu-cn5yu9k@h$+bq^=kf$#f!c3'
  16. # SECURITY WARNING: don't run with debug turned on in production!
  17. DEBUG = True
  18. ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
  19. # Application definition
  20. INSTALLED_APPS = [
  21. 'django.contrib.admin',
  22. 'django.contrib.auth',
  23. 'django.contrib.contenttypes',
  24. 'django.contrib.sessions',
  25. 'django.contrib.messages',
  26. 'django.contrib.staticfiles',
  27. 'rest_framework',
  28. 'django_filters',
  29. 'spectrometer'
  30. ]
  31. MIDDLEWARE = [
  32. 'django.middleware.security.SecurityMiddleware',
  33. 'django.contrib.sessions.middleware.SessionMiddleware',
  34. 'django.middleware.common.CommonMiddleware',
  35. 'django.middleware.csrf.CsrfViewMiddleware',
  36. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  37. 'django.contrib.messages.middleware.MessageMiddleware',
  38. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  39. ]
  40. ROOT_URLCONF = 'mserv00.urls'
  41. TEMPLATES = [
  42. {
  43. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  44. 'DIRS': [],
  45. 'APP_DIRS': True,
  46. 'OPTIONS': {
  47. 'context_processors': [
  48. 'django.template.context_processors.request',
  49. 'django.contrib.auth.context_processors.auth',
  50. 'django.contrib.messages.context_processors.messages',
  51. ],
  52. },
  53. },
  54. ]
  55. WSGI_APPLICATION = 'mserv00.wsgi.application'
  56. # Database
  57. # https://docs.djangoproject.com/en/5.2/ref/settings/#databases
  58. DATABASES = {
  59. 'default': {
  60. 'ENGINE': 'django.db.backends.postgresql',
  61. 'NAME': 'specdata',
  62. 'USER': 'specadmin',
  63. 'PASSWORD': 'specadmin',
  64. 'HOST': 'localhost',
  65. 'PORT': '5432',
  66. }
  67. }
  68. # Password validation
  69. # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
  70. AUTH_PASSWORD_VALIDATORS = [
  71. {
  72. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  73. },
  74. {
  75. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  76. },
  77. {
  78. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  79. },
  80. {
  81. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  82. },
  83. ]
  84. REST_FRAMEWORK = {
  85. 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
  86. 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
  87. 'DEFAULT_AUTHENTICATION_CLASSES': [
  88. 'rest_framework.authentication.BasicAuthentication',
  89. 'rest_framework.authentication.SessionAuthentication'],
  90. 'DEFAULT_PERMISSION_CLASSES': [
  91. 'rest_framework.permissions.IsAuthenticated',
  92. ],
  93. 'PAGE_SIZE': 10
  94. }
  95. # Internationalization
  96. # https://docs.djangoproject.com/en/5.2/topics/i18n/
  97. LANGUAGE_CODE = 'ru-ru'
  98. TIME_ZONE = 'Europe/Moscow'
  99. USE_I18N = True
  100. USE_TZ = True
  101. # Static files (CSS, JavaScript, Images)
  102. # https://docs.djangoproject.com/en/5.2/howto/static-files/
  103. STATIC_URL = 'static/'
  104. STATIC_ROOT = BASE_DIR / 'static'
  105. # Default primary key field type
  106. # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
  107. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'