settings.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. 'ckeditor',
  43. 'captcha',
  44. 'landing.apps.LandingConfig',
  45. ]
  46. MIDDLEWARE = [
  47. 'django.middleware.security.SecurityMiddleware',
  48. 'django.contrib.sessions.middleware.SessionMiddleware',
  49. 'django.middleware.locale.LocaleMiddleware',
  50. 'django.middleware.common.CommonMiddleware',
  51. 'django.middleware.csrf.CsrfViewMiddleware',
  52. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  53. 'django.contrib.messages.middleware.MessageMiddleware',
  54. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  55. 'django.contrib.admindocs.middleware.XViewMiddleware',
  56. ]
  57. ROOT_URLCONF = 'core.urls'
  58. #SESSION_EXPIRE_AT_BROWSER_CLOSE = True
  59. #SESSION_SECURITY_WARN_AFTER = 5
  60. #SESSION_SECURITY_EXPIRE_AFTER = 12
  61. INTERNAL_IPS = [
  62. '127.0.0.1',
  63. ]
  64. TEMPLATES = [
  65. {
  66. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  67. 'DIRS': [
  68. BASE_DIR / "templates"
  69. ],
  70. 'APP_DIRS': True,
  71. 'OPTIONS': {
  72. 'context_processors': [
  73. 'django.template.context_processors.debug',
  74. 'django.template.context_processors.request',
  75. 'django.contrib.auth.context_processors.auth',
  76. 'django.contrib.messages.context_processors.messages',
  77. "django.template.context_processors.i18n",
  78. "django.template.context_processors.media",
  79. "django.template.context_processors.static",
  80. "django.template.context_processors.tz",
  81. "design_template.context_processors.get_name_system",
  82. ],
  83. 'libraries': {
  84. 'custom_tags':'tickets.template_tags.custom_tags'
  85. }
  86. },
  87. },
  88. ]
  89. WSGI_APPLICATION = 'core.wsgi.application'
  90. # Password validation
  91. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  92. AUTH_PASSWORD_VALIDATORS = [
  93. {
  94. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  95. },
  96. {
  97. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  98. },
  99. {
  100. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  101. },
  102. {
  103. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  104. },
  105. ]
  106. # Internationalization
  107. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  108. LANGUAGE_CODE = 'ru'
  109. TIME_ZONE = 'UTC'
  110. USE_I18N = True
  111. USE_TZ = True
  112. SITE_ID = 1
  113. LANGUAGES = [
  114. ('ru', _('Russian')),
  115. ('en', _('English')),
  116. ]
  117. # Static files (CSS, JavaScript, Images)
  118. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  119. STATIC_URL = '/static/'
  120. STATICFILES_DIRS = [BASE_DIR / "SharixAdmin/static/", BASE_DIR / "tickets/static/"]
  121. STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
  122. # Uploaded media
  123. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  124. MEDIA_URL = "/media/"
  125. # Default primary key field type
  126. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  127. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  128. AUTH_USER_MODEL = 'SharixAdmin.SharixUser'
  129. #Name System
  130. NAME_SYSTEM = 'Sharix'