settings.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. from pathlib import Path
  2. import os
  3. from core.db_settings import *
  4. from core.api_settings import *
  5. from core.tickets_mail_settings import *
  6. from core.jazzmin_settings import *
  7. import core.config as conf
  8. from django.utils.translation import gettext_lazy as _
  9. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  10. BASE_DIR = Path(__file__).resolve().parent.parent
  11. # SECURITY WARNING: keep the secret key used in production secret!
  12. SECRET_KEY = conf.SECRET_KEY
  13. # SECURITY WARNING: don't run with debug turned on in production!
  14. DEBUG = conf.DEBUG
  15. ALLOWED_HOSTS = conf.ALLOWED_HOSTS
  16. CSRF_TRUSTED_ORIGINS = conf.CSRF_TRUSTED_ORIGINS
  17. # Application definition
  18. INSTALLED_APPS = [
  19. 'design_template',
  20. 'jazzmin',
  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. 'SharixAdmin.apps.SharixadminConfig',
  28. 'tickets.apps.ticketsConfig',
  29. 'metaservicesynced.apps.MetaservicesyncedConfig',
  30. 'openlocal.apps.OpenlocalConfig',
  31. 'django_tables2',
  32. "django.contrib.sites",
  33. "django.contrib.flatpages",
  34. "django.contrib.admindocs",
  35. "django_extensions",
  36. 'rest_framework',
  37. 'rest_framework.authtoken',
  38. 'djoser',
  39. 'schema_graph',
  40. 'drf_yasg',
  41. 'django_spaghetti',
  42. ]
  43. MIDDLEWARE = [
  44. 'django.middleware.security.SecurityMiddleware',
  45. 'django.contrib.sessions.middleware.SessionMiddleware',
  46. 'django.middleware.locale.LocaleMiddleware',
  47. 'django.middleware.common.CommonMiddleware',
  48. 'django.middleware.csrf.CsrfViewMiddleware',
  49. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  50. 'django.contrib.messages.middleware.MessageMiddleware',
  51. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  52. 'django.contrib.admindocs.middleware.XViewMiddleware',
  53. ]
  54. ROOT_URLCONF = 'core.urls'
  55. #SESSION_EXPIRE_AT_BROWSER_CLOSE = True
  56. #SESSION_SECURITY_WARN_AFTER = 5
  57. #SESSION_SECURITY_EXPIRE_AFTER = 12
  58. INTERNAL_IPS = [
  59. '127.0.0.1',
  60. ]
  61. TEMPLATES = [
  62. {
  63. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  64. 'DIRS': [
  65. BASE_DIR / "templates"
  66. ],
  67. 'APP_DIRS': True,
  68. 'OPTIONS': {
  69. 'context_processors': [
  70. 'django.template.context_processors.debug',
  71. 'django.template.context_processors.request',
  72. 'django.contrib.auth.context_processors.auth',
  73. 'django.contrib.messages.context_processors.messages',
  74. "django.template.context_processors.i18n",
  75. "django.template.context_processors.media",
  76. "django.template.context_processors.static",
  77. "django.template.context_processors.tz",
  78. ],
  79. 'libraries': {
  80. 'custom_tags':'tickets.template_tags.custom_tags'
  81. }
  82. },
  83. },
  84. ]
  85. WSGI_APPLICATION = 'core.wsgi.application'
  86. # Password validation
  87. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  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. # Internationalization
  103. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  104. LANGUAGE_CODE = 'ru'
  105. TIME_ZONE = 'UTC'
  106. USE_I18N = True
  107. USE_TZ = True
  108. SITE_ID = 1
  109. LANGUAGES = [
  110. ('ru', _('Russian')),
  111. ('en', _('English')),
  112. ]
  113. # Static files (CSS, JavaScript, Images)
  114. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  115. STATIC_URL = conf.STATIC_URL
  116. STATICFILES_DIRS = conf.STATICFILES_DIRS
  117. STATIC_ROOT = conf.STATIC_ROOT
  118. # Uploaded media
  119. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  120. MEDIA_URL = "/media/"
  121. # Default primary key field type
  122. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  123. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  124. AUTH_USER_MODEL = 'SharixAdmin.SharixUser'