settings.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. """
  2. Django settings for system project.
  3. Generated by 'django-admin startproject' using Django 3.2.4.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/3.2/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/3.2/ref/settings/
  8. """
  9. from pathlib import Path
  10. #import ldap
  11. #from django_auth_ldap.config import LDAPSearch
  12. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  13. BASE_DIR = Path(__file__).resolve().parent.parent
  14. # Quick-start development settings - unsuitable for production
  15. # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
  16. # SECURITY WARNING: keep the secret key used in production secret!
  17. SECRET_KEY = 'django-insecure-*=si4xyn-x2m9$#f=bxy84e6u7ec2fz=@7yx5t6o=-5+)qbin*'
  18. # SECURITY WARNING: don't run with debug turned on in production!
  19. DEBUG = True
  20. ALLOWED_HOSTS = ['*']
  21. # Application definition
  22. INSTALLED_APPS = [
  23. 'django.contrib.admin',
  24. 'django.contrib.auth',
  25. 'django.contrib.contenttypes',
  26. 'django.contrib.sessions',
  27. 'django.contrib.messages',
  28. 'django.contrib.staticfiles',
  29. 'trumbowyg',
  30. 'import_export',
  31. 'crispy_forms',
  32. 'core',
  33. 'gest_clin',
  34. 'parc_info',
  35. 'gest_user',
  36. 'gest_taches',
  37. ]
  38. IMPORT_EXPORT_USE_TRANSACTIONS = True
  39. CRISPY_TEMPLATE_PACK = 'bootstrap4'
  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. ]
  49. # AUTH_LDAP_SERVER_URI = "ldap://172.16.106.102"
  50. # AUTH_LDAP_BIND_DN = "seafile.adm@intra.stjacques"
  51. # AUTH_LDAP_BIND_PASSWORD = "DxbYwD5V2t"
  52. # AUTH_LDAP_USER_SEARCH = LDAPSearch("OU=Informatique,OU=Administratif,Ou=Gentilly,OU=Utilisateurs,DC=intra,DC=stjacques", ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)")
  53. # AUTH_LDAP_USER_ATTR_MAP = {
  54. # "first_name": "givenName",
  55. # "last_name": "sn",
  56. # "email": "mail",
  57. # "username": "sAMAccountName",
  58. # }
  59. # AUTH_LDAP_ALWAYS_UPDATE_USER = True
  60. AUTHENTICATION_BACKENDS = [
  61. # "django_auth_ldap.backend.LDAPBackend",
  62. "django.contrib.auth.backends.ModelBackend",
  63. ]
  64. ROOT_URLCONF = 'system.urls'
  65. TEMPLATES = [
  66. {
  67. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  68. 'DIRS': [],
  69. 'APP_DIRS': True,
  70. 'OPTIONS': {
  71. 'context_processors': [
  72. 'django.template.context_processors.debug',
  73. 'django.template.context_processors.request',
  74. 'django.contrib.auth.context_processors.auth',
  75. 'django.contrib.messages.context_processors.messages',
  76. ],
  77. },
  78. },
  79. ]
  80. WSGI_APPLICATION = 'system.wsgi.application'
  81. # Database
  82. # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
  83. DATABASES = {
  84. 'default': {
  85. 'ENGINE': 'django.db.backends.sqlite3',
  86. 'NAME': BASE_DIR / 'db.sqlite3',
  87. }
  88. }
  89. # EMAIL
  90. # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  91. # EMAIL_HOST = 'smtp.elsan.care'
  92. # EMAIL_PORT = '25'
  93. # EMAIL_USE_TLS = False
  94. # EMAIL_HOST_USER = 'smtp.gen@elsan.care'
  95. # EMAIL_HOST_PASSWORD = 'c!fgx1cPlsd%JxW4$SKf!'
  96. # Password validation
  97. # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
  98. AUTH_PASSWORD_VALIDATORS = [
  99. {
  100. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  101. },
  102. {
  103. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  104. },
  105. {
  106. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  107. },
  108. {
  109. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  110. },
  111. ]
  112. # Internationalization
  113. # https://docs.djangoproject.com/en/3.2/topics/i18n/
  114. LANGUAGE_CODE = 'fr-fr'
  115. TIME_ZONE = 'UTC'
  116. USE_I18N = True
  117. USE_L10N = True
  118. USE_TZ = True
  119. # Static files (CSS, JavaScript, Images)
  120. # https://docs.djangoproject.com/en/3.2/howto/static-files/
  121. STATIC_URL = '/static/'
  122. STATICFILES_DIRS = [
  123. BASE_DIR / "static",
  124. ]
  125. # Default primary key field type
  126. # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
  127. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  128. LOGGING = {
  129. "version": 1,
  130. "disable_existing_loggers": False,
  131. "handlers": {"console": {"class": "logging.StreamHandler"}},
  132. "loggers": {"django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]}},
  133. }