settings.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. 'webservice_running.apps.WebserviceRunningConfig',
  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. "design_template.context_processors.get_name_system",
  79. ],
  80. 'libraries': {
  81. 'custom_tags':'tickets.template_tags.custom_tags'
  82. }
  83. },
  84. },
  85. ]
  86. WSGI_APPLICATION = 'core.wsgi.application'
  87. # Password validation
  88. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  89. AUTH_PASSWORD_VALIDATORS = [
  90. {
  91. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  92. },
  93. {
  94. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  95. },
  96. {
  97. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  98. },
  99. {
  100. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  101. },
  102. ]
  103. # Internationalization
  104. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  105. LANGUAGE_CODE = 'ru'
  106. TIME_ZONE = 'UTC'
  107. USE_I18N = True
  108. USE_TZ = True
  109. SITE_ID = 1
  110. LANGUAGES = [
  111. ('ru', _('Russian')),
  112. ('en', _('English')),
  113. ]
  114. # Static files (CSS, JavaScript, Images)
  115. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  116. STATIC_URL = '/static/'
  117. STATICFILES_DIRS = [BASE_DIR / "SharixAdmin/static/", BASE_DIR / "tickets/static/"]
  118. STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
  119. # Uploaded media
  120. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  121. MEDIA_URL = "/media/"
  122. # Default primary key field type
  123. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  124. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  125. AUTH_USER_MODEL = 'SharixAdmin.SharixUser'
  126. #Name System
  127. NAME_SYSTEM = 'Sharix'