settings.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  9. BASE_DIR = Path(__file__).resolve().parent.parent
  10. # SECURITY WARNING: keep the secret key used in production secret!
  11. SECRET_KEY = conf.SECRET_KEY
  12. # SECURITY WARNING: don't run with debug turned on in production!
  13. DEBUG = conf.DEBUG
  14. ALLOWED_HOSTS = conf.ALLOWED_HOSTS
  15. CSRF_TRUSTED_ORIGINS = conf.CSRF_TRUSTED_ORIGINS
  16. # Application definition
  17. INSTALLED_APPS = [
  18. 'jazzmin',
  19. 'django.contrib.admin',
  20. 'django.contrib.auth',
  21. 'django.contrib.contenttypes',
  22. 'django.contrib.sessions',
  23. 'django.contrib.messages',
  24. 'django.contrib.staticfiles',
  25. 'SharixAdmin.apps.SharixadminConfig',
  26. 'tickets.apps.ticketsConfig',
  27. 'metaservicesynced.apps.MetaservicesyncedConfig',
  28. 'django_tables2',
  29. "django.contrib.sites",
  30. "django.contrib.flatpages",
  31. "django.contrib.admindocs",
  32. "django_extensions",
  33. 'rest_framework',
  34. 'rest_framework.authtoken',
  35. 'djoser',
  36. 'schema_graph',
  37. 'drf_yasg',
  38. 'django_spaghetti',
  39. ]
  40. MIDDLEWARE = [
  41. 'django.middleware.security.SecurityMiddleware',
  42. 'django.contrib.sessions.middleware.SessionMiddleware',
  43. 'django.middleware.common.CommonMiddleware',
  44. 'django.middleware.csrf.CsrfViewMiddleware',
  45. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  46. 'django.contrib.messages.middleware.MessageMiddleware',
  47. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  48. 'django.contrib.admindocs.middleware.XViewMiddleware',
  49. ]
  50. ROOT_URLCONF = 'core.urls'
  51. #SESSION_EXPIRE_AT_BROWSER_CLOSE = True
  52. #SESSION_SECURITY_WARN_AFTER = 5
  53. #SESSION_SECURITY_EXPIRE_AFTER = 12
  54. INTERNAL_IPS = [
  55. '127.0.0.1',
  56. ]
  57. TEMPLATES = [
  58. {
  59. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  60. 'DIRS': [
  61. BASE_DIR / "templates"
  62. ],
  63. 'APP_DIRS': True,
  64. 'OPTIONS': {
  65. 'context_processors': [
  66. 'django.template.context_processors.debug',
  67. 'django.template.context_processors.request',
  68. 'django.contrib.auth.context_processors.auth',
  69. 'django.contrib.messages.context_processors.messages',
  70. "django.template.context_processors.i18n",
  71. "django.template.context_processors.media",
  72. "django.template.context_processors.static",
  73. "django.template.context_processors.tz",
  74. ],
  75. 'libraries': {
  76. 'custom_tags':'tickets.template_tags.custom_tags'
  77. }
  78. },
  79. },
  80. ]
  81. WSGI_APPLICATION = 'core.wsgi.application'
  82. # Password validation
  83. # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
  84. AUTH_PASSWORD_VALIDATORS = [
  85. {
  86. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  87. },
  88. {
  89. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  90. },
  91. {
  92. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  93. },
  94. {
  95. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  96. },
  97. ]
  98. # Internationalization
  99. # https://docs.djangoproject.com/en/4.1/topics/i18n/
  100. LANGUAGE_CODE = 'ru'
  101. TIME_ZONE = 'UTC'
  102. USE_I18N = True
  103. USE_TZ = True
  104. SITE_ID = 1
  105. # Static files (CSS, JavaScript, Images)
  106. # https://docs.djangoproject.com/en/4.1/howto/static-files/
  107. STATIC_URL = conf.STATIC_URL
  108. STATICFILES_DIRS = conf.STATICFILES_DIRS
  109. STATIC_ROOT = conf.STATIC_ROOT
  110. # Uploaded media
  111. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  112. MEDIA_URL = "/media/"
  113. # Default primary key field type
  114. # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
  115. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  116. AUTH_USER_MODEL = 'SharixAdmin.SharixUser'