settings.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. 'default': {
  89. 'ENGINE': 'django.db.backends.mysql',
  90. 'NAME': 'gestclin', # db name
  91. 'USER': 'root',
  92. 'PASSWORD': '7AX8ifyKodVj9hSw',
  93. 'HOST': 'mariadb',
  94. 'PORT': '3306',
  95. 'OPTIONS': {'charset': 'utf8mb4',},
  96. }
  97. }
  98. # EMAIL
  99. # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  100. # EMAIL_HOST = 'smtp.elsan.care'
  101. # EMAIL_PORT = '25'
  102. # EMAIL_USE_TLS = False
  103. # EMAIL_HOST_USER = 'smtp.gen@elsan.care'
  104. # EMAIL_HOST_PASSWORD = 'c!fgx1cPlsd%JxW4$SKf!'
  105. # Password validation
  106. # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
  107. AUTH_PASSWORD_VALIDATORS = [
  108. {
  109. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  110. },
  111. {
  112. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  113. },
  114. {
  115. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  116. },
  117. {
  118. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  119. },
  120. ]
  121. # Internationalization
  122. # https://docs.djangoproject.com/en/3.2/topics/i18n/
  123. LANGUAGE_CODE = 'fr-fr'
  124. TIME_ZONE = 'UTC'
  125. USE_I18N = True
  126. USE_L10N = True
  127. USE_TZ = True
  128. # Static files (CSS, JavaScript, Images)
  129. # https://docs.djangoproject.com/en/3.2/howto/static-files/
  130. STATIC_URL = '/static/'
  131. STATICFILES_DIRS = [
  132. BASE_DIR / "static",
  133. ]
  134. # Default primary key field type
  135. # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
  136. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  137. LOGGING = {
  138. "version": 1,
  139. "disable_existing_loggers": False,
  140. "handlers": {"console": {"class": "logging.StreamHandler"}},
  141. "loggers": {"django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]}},
  142. }