settings.py 3.9 KB

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