settings.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. import core.settings_vars as sv
  2. import os
  3. from django.contrib.messages import constants as message_constants
  4. from django.utils.translation import gettext_lazy as _
  5. from pathlib import Path
  6. import ldap
  7. from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
  8. ########
  9. #
  10. # Django
  11. #
  12. ########
  13. # Build paths inside the project like this: BASE_DIR / 'subdir'.
  14. BASE_DIR = Path(__file__).resolve().parent.parent
  15. # SECURITY WARNING: keep the secret key used in production secret!
  16. SECRET_KEY = sv.SECRET_KEY
  17. # SECURITY WARNING: don't run with debug turned on in production!
  18. DEBUG = sv.DEBUG
  19. CSRF_TRUSTED_ORIGINS = sv.CSRF_TRUSTED_ORIGINS
  20. ALLOWED_HOSTS = sv.ALLOWED_HOSTS
  21. INTERNAL_IPS = sv.INTERNAL_IPS
  22. # https if nginx responce HTTP_X_FORWARDED_PROTO=https
  23. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  24. # Application definition
  25. INSTALLED_APPS = [
  26. 'design_template',
  27. 'jazzmin',
  28. 'django.contrib.admin',
  29. 'django.contrib.auth',
  30. 'django.contrib.contenttypes',
  31. 'django.contrib.sessions',
  32. 'django.contrib.messages',
  33. 'django.contrib.staticfiles',
  34. 'user.apps.UserConfig',
  35. 'sharix_admin.apps.ShariXAdminConfig',
  36. 'tickets.apps.TicketsConfig',
  37. 'dbsynce.apps.DbsyncedConfig',
  38. 'webservice_running.apps.WebserviceRunningConfig',
  39. 'django_tables2',
  40. 'schema_graph',
  41. # "django.contrib.sites",
  42. # "django.contrib.flatpages",
  43. "django_extensions",
  44. 'rest_framework',
  45. "rest_framework_api_key",
  46. 'rest_framework.authtoken',
  47. 'djoser',
  48. 'drf_yasg',
  49. 'django_spaghetti',
  50. 'debug_toolbar',
  51. 'ckeditor',
  52. 'fontawesomefree',
  53. 'landing',
  54. 'captcha',
  55. 'django_filters',
  56. ]
  57. MIDDLEWARE = [
  58. 'django.middleware.security.SecurityMiddleware',
  59. 'django.contrib.sessions.middleware.SessionMiddleware',
  60. 'django.middleware.locale.LocaleMiddleware',
  61. 'django.middleware.common.CommonMiddleware',
  62. 'django.middleware.csrf.CsrfViewMiddleware',
  63. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  64. 'django.contrib.messages.middleware.MessageMiddleware',
  65. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  66. "debug_toolbar.middleware.DebugToolbarMiddleware",
  67. ]
  68. ROOT_URLCONF = "core.urls"
  69. LOGIN_URL = "sharix_admin:auth_login"
  70. #LOGIN_REDIRECT_URL = "sharix_admin:main"
  71. LOGIN_REDIRECT_URL = sv.LOGIN_REDIRECT_URL
  72. LOGOUT_REDIRECT_URL = "sharix_admin:auth_login"
  73. SESSION_EXPIRE_AT_BROWSER_CLOSE = False
  74. SESSION_SECURITY_WARN_AFTER = 5
  75. SESSION_SECURITY_EXPIRE_AFTER = 12
  76. TEMPLATES = [
  77. {
  78. "BACKEND": "django.template.backends.django.DjangoTemplates",
  79. "DIRS": [os.path.join(BASE_DIR, "templates")],
  80. "APP_DIRS": True,
  81. "OPTIONS": {
  82. "context_processors": [
  83. "django.template.context_processors.debug",
  84. "django.template.context_processors.request",
  85. "django.contrib.auth.context_processors.auth",
  86. "django.template.context_processors.i18n",
  87. "django.template.context_processors.media",
  88. "django.template.context_processors.static",
  89. "django.template.context_processors.tz",
  90. "design_template.context_processors.get_name_system",
  91. "django.contrib.messages.context_processors.messages",
  92. ],
  93. },
  94. }
  95. ]
  96. WSGI_APPLICATION = 'core.wsgi.application'
  97. # Database
  98. # https://docs.djangoproject.com/en/4.0/ref/settings/#databases
  99. if sv.DB_NAME:
  100. DATABASES = {
  101. 'default': {
  102. 'ENGINE': 'django.db.backends.postgresql',
  103. 'NAME': sv.DB_NAME,
  104. 'USER': sv.DB_USER,
  105. 'PASSWORD': sv.DB_PASSWORD,
  106. 'HOST': sv.DB_HOST,
  107. 'PORT': sv.DB_PORT,
  108. }
  109. }
  110. else:
  111. DATABASES = {
  112. 'default': {
  113. 'ENGINE': 'django.db.backends.sqlite3',
  114. 'NAME': BASE_DIR / 'db.sqlite3',
  115. }
  116. }
  117. # Password validation
  118. # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
  119. AUTH_PASSWORD_VALIDATORS = [
  120. {
  121. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  122. },
  123. {
  124. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  125. },
  126. {
  127. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  128. },
  129. {
  130. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  131. },
  132. ]
  133. #Password hashgen
  134. PASSWORD_HASHERS = [
  135. 'django.contrib.auth.hashers.Argon2PasswordHasher',
  136. 'django.contrib.auth.hashers.PBKDF2PasswordHasher',
  137. 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
  138. 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
  139. 'django.contrib.auth.hashers.ScryptPasswordHasher',
  140. ]
  141. # Internationalization
  142. # https://docs.djangoproject.com/en/4.0/topics/i18n/
  143. LANGUAGE_CODE = 'ru'
  144. USE_TZ = True
  145. TIME_ZONE = 'Europe/Moscow'
  146. SITE_ID = 1
  147. # If you set this to False, Django will make some optimizations so as not
  148. # to load the internationalization machinery.
  149. USE_I18N = True
  150. LANGUAGES = [
  151. ('ru', _('Russian')),
  152. ('en', _('English')),
  153. ]
  154. # Static files (CSS, JavaScript, Images)
  155. # https://docs.djangoproject.com/en/4.0/howto/static-files/
  156. STATIC_URL = "/static/"
  157. STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
  158. # Uploaded media
  159. MEDIA_URL = "/media/"
  160. MEDIA_ROOT = os.path.join(BASE_DIR, "media")
  161. # Without this, uploaded files > 4MB end up with perm 0600, unreadable by web server process
  162. FILE_UPLOAD_PERMISSIONS = 0o644
  163. # Override CSS class for the ERROR tag level to match Bootstrap class name
  164. MESSAGE_TAGS = {message_constants.ERROR: "danger"}
  165. # Default primary key field type
  166. # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
  167. DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
  168. AUTH_USER_MODEL = 'user.ShariXUser'
  169. NAME_SYSTEM = sv.NAME_SYSTEM
  170. ########
  171. #
  172. # Jazzmin
  173. #
  174. ########
  175. JAZZMIN_SETTINGS = {
  176. # title of the window (Will default to current_admin_site.site_title if absent or None)
  177. "site_title": "ShariX Admin",
  178. # Title on the login screen (19 chars max) (defaults to current_admin_site.site_header if absent or None)
  179. "site_header": "ShariX Platform",
  180. # Title on the brand (19 chars max) (defaults to current_admin_site.site_header if absent or None)
  181. "site_brand": "ShariX Platform",
  182. # Logo to use for your site, must be present in static files, used for brand on top left
  183. "site_logo": "sharix_admin/img/logo.png",
  184. # Logo to use for your site, must be present in static files, used for login form logo (defaults to site_logo)
  185. "login_logo": None,
  186. # Logo to use for login form in dark themes (defaults to login_logo)
  187. "login_logo_dark": None,
  188. # CSS classes that are applied to the logo above
  189. "site_logo_classes": "img-circle",
  190. # Relative path to a favicon for your site, will default to site_logo if absent (ideally 32x32 px)
  191. "site_icon": None,
  192. # Welcome text on the login screen
  193. "welcome_sign": "Welcome to the ShariX Admin",
  194. # Copyright on the footer
  195. "copyright": "Acme Library Ltd",
  196. # List of model admins to search from the search bar, search bar omitted if excluded
  197. # If you want to use a single search field you dont need to use a list, you can use a simple string
  198. "search_model": ["sharix_admin.SharixUser"],
  199. # Field name on user model that contains avatar ImageField/URLField/Charfield or a callable that receives the user
  200. "user_avatar": "",
  201. ############
  202. # Top Menu #
  203. ############
  204. # Links to put along the top menu
  205. "topmenu_links": [
  206. # Url that gets reversed (Permissions can be added)
  207. {"name": "Главная", "url": "admin:index", "permissions": ["auth.view_user"]},
  208. # external url that opens in a new window (Permissions can be added)
  209. # {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True},
  210. # model admin to link to (Permissions checked against model)
  211. {"model": "sharix_admin.SharixUser"},
  212. # App with dropdown menu to all its models pages (Permissions checked against models)
  213. {"app": "tickets"},
  214. ],
  215. #############
  216. # User Menu #
  217. #############
  218. # Additional links to include in the user menu on the top right ("app" url type is not allowed)
  219. # "usermenu_links": [
  220. # {"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True},
  221. # {"model": "sharix_admin.SharixUser"}
  222. # ],
  223. # #############
  224. # # Side Menu #
  225. # #############
  226. # # Whether to display the side menu
  227. # "show_sidebar": True,
  228. # # Whether to aut expand the menu
  229. # "navigation_expanded": True,
  230. # # Hide these apps when generating side menu e.g (auth)
  231. # "hide_apps": [],
  232. # # Hide these models when generating side menu (e.g auth.user)
  233. # "hide_models": [],
  234. # # List of apps (and/or models) to base side menu ordering off of (does not need to contain all apps/models)
  235. # #"order_with_respect_to": ["auth", "books", "books.author", "books.book"],
  236. # # Custom links to append to app groups, keyed on app name
  237. # "custom_links": {
  238. # "tickets": [{
  239. # "name": "Make Messages",
  240. # "url": "make_messages",
  241. # "icon": "fas fa-comments",
  242. # "permissions": ["tickets.view_book"]
  243. # }]
  244. # },
  245. # # Custom icons for side menu apps/models See https://fontawesome.com/icons?d=gallery&m=free&v=5.0.0,5.0.1,5.0.10,5.0.11,5.0.12,5.0.13,5.0.2,5.0.3,5.0.4,5.0.5,5.0.6,5.0.7,5.0.8,5.0.9,5.1.0,5.1.1,5.2.0,5.3.0,5.3.1,5.4.0,5.4.1,5.4.2,5.13.0,5.12.0,5.11.2,5.11.1,5.10.0,5.9.0,5.8.2,5.8.1,5.7.2,5.7.1,5.7.0,5.6.3,5.5.0,5.4.2
  246. # # for the full list of 5.13.0 free icon classes
  247. "icons": {
  248. "auth": "fas fa-users-cog",
  249. "auth.user": "fas fa-user",
  250. "auth.Group": "fas fa-users",
  251. "sharix_admin": "fas fa-users-cog",
  252. "sharix_admin.SharixUser": "fas fa-user",
  253. "tickets.Task": "fas fa-check",
  254. "tickets.TaskList": "fas fa-list",
  255. "tickets.Comment": "fas fa-comment",
  256. "tickets.Attachment": "fas fa-file",
  257. },
  258. # # Icons that are used when one is not manually specified
  259. # # "default_icon_parents": "fas fa-chevron-circle-right",
  260. # # "default_icon_children": "fas fa-circle",
  261. # #################
  262. # # Related Modal #
  263. # #################
  264. # # Use modals instead of popups
  265. # "related_modal_active": False,
  266. # #############
  267. # # UI Tweaks #
  268. # #############
  269. # # Relative paths to custom CSS/JS scripts (must be present in static files)
  270. "custom_css": None,
  271. "custom_js": None,
  272. # Whether to link font from fonts.googleapis.com (use custom_css to supply font otherwise)
  273. "use_google_fonts_cdn": True,
  274. # # Whether to show the UI customizer on the sidebar
  275. "show_ui_builder": True,
  276. ###############
  277. # Change view #
  278. ###############
  279. # Render out the change view as a single form, or in tabs, current options are
  280. # - single
  281. # - horizontal_tabs (default)
  282. # - vertical_tabs
  283. # - collapsible
  284. # - carousel
  285. # "changeform_format": "horizontal_tabs",
  286. # override change forms on a per modeladmin basis
  287. # "changeform_format_overrides": {"sharix_admin.SharixUser": "collapsible", "auth.group": "vertical_tabs"},
  288. # Add a language dropdown into the admin
  289. # "language_chooser": True,
  290. }
  291. JAZZMIN_UI_TWEAKS = {
  292. "navbar_small_text": True,
  293. "footer_small_text": True,
  294. "body_small_text": False,
  295. "brand_small_text": True,
  296. "brand_colour": "navbar-light",
  297. "accent": "accent-navy",
  298. "navbar": "navbar-navy navbar-dark",
  299. "no_navbar_border": False,
  300. "navbar_fixed": False,
  301. "layout_boxed": False,
  302. "footer_fixed": False,
  303. "sidebar_fixed": True,
  304. "sidebar": "sidebar-light-navy",
  305. "sidebar_nav_small_text": False,
  306. "sidebar_disable_expand": False,
  307. "sidebar_nav_child_indent": False,
  308. "sidebar_nav_compact_style": True,
  309. "sidebar_nav_legacy_style": False,
  310. "sidebar_nav_flat_style": False,
  311. "theme": "default",
  312. "dark_mode_theme": None,
  313. "button_classes": {
  314. "primary": "btn-outline-primary",
  315. "secondary": "btn-outline-secondary",
  316. "info": "btn-outline-info",
  317. "warning": "btn-outline-warning",
  318. "danger": "btn-outline-danger",
  319. "success": "btn-outline-success"
  320. },
  321. "actions_sticky_top": False
  322. }
  323. ########
  324. #
  325. # API
  326. #
  327. ########
  328. API_URL = sv.API_URL
  329. REST_FRAMEWORK = {
  330. # Use Django's standard `django.contrib.auth` permissions,
  331. # or allow read-only access for unauthenticated users.
  332. 'DEFAULT_RENDERER_CLASSES': [
  333. 'rest_framework.renderers.JSONRenderer',
  334. 'rest_framework.renderers.BrowsableAPIRenderer',
  335. ],
  336. 'DEFAULT_PERMISSION_CLASSES': [
  337. # 'rest_framework.permissions.AllowAny',
  338. # 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
  339. ],
  340. 'DEFAULT_AUTHENTICATION_CLASSES': (
  341. 'rest_framework.authentication.TokenAuthentication',
  342. 'rest_framework.authentication.BasicAuthentication',
  343. 'rest_framework.authentication.SessionAuthentication',
  344. ),
  345. 'DEFAULT_FILTER_BACKENDS': (
  346. 'django_filters.rest_framework.DjangoFilterBackend',
  347. ),
  348. }
  349. SPAGHETTI_SAUCE = {
  350. 'apps': [
  351. 'auth',
  352. 'sharix_admin',
  353. 'tickets',
  354. 'admin',
  355. # 'flatpages',
  356. 'sessions',
  357. # 'sites',
  358. 'dbsynce'
  359. ],
  360. 'show_fields': False,
  361. 'show_proxy': True,
  362. }
  363. GRAPH_MODELS = {
  364. 'all_applications': True,
  365. 'group_models': True,
  366. }
  367. # Email
  368. EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  369. EMAIL_HOST = sv.EMAIL_HOST
  370. EMAIL_PORT = sv.EMAIL_PORT
  371. EMAIL_USE_TLS = sv.EMAIL_USE_TLS
  372. EMAIL_HOST_USER = sv.EMAIL_HOST_USER
  373. EMAIL_HOST_PASSWORD = sv.EMAIL_HOST_PASSWORD
  374. DEFAULT_FROM_EMAIL = sv.DEFAULT_FROM_EMAIL
  375. #LDAP
  376. # Baseline configuration.
  377. AUTH_LDAP_PROTO = "ldap"
  378. AUTH_LDAP_HOST = "ldap.sharix.ru"
  379. AUTH_LDAP_PORT = '389' # must be str
  380. #AUTH_LDAP_GID = "502" # group ID to add signed up users
  381. #AUTH_LDAP_BASE_UID = 1000 # Integer
  382. #AUTH_LDAP_SERVER_URI = LDAP_PROTO+"://"+LDAP_HOST+":"+LDAP_PORT
  383. AUTH_LDAP_SERVER_URI = AUTH_LDAP_PROTO+"://"+AUTH_LDAP_HOST
  384. #If we want to use there - we should create custom ldap login backend - https://django-auth-ldap.readthedocs.io/en/latest/custombehavior.html
  385. #LDAP_LOGIN_ATTEMPT_LIMIT = 100
  386. #LDAP_RESET_TIME = 15 * 60
  387. #AUTH_LDAP_BASE_DN = "dc=ldap,dc=sharix,dc=ru"
  388. AUTH_LDAP_BASE_DN = "dc=ldap,dc=sharix,dc=ru"
  389. AUTH_LDAP_BIND_DN = "cn=admin,dc=ldap,dc=sharix,dc=ru"
  390. AUTH_LDAP_BIND_PASSWORD = "secret"
  391. AUTH_LDAP_USER_SEARCH = LDAPSearch(
  392. "ou=users,dc=ldap,dc=sharix,dc=ru", ldap.SCOPE_SUBTREE, "(telephoneNumber=%(user)s)"
  393. # "ou=users,dc=ldap,dc=sharix,dc=ru", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"
  394. )
  395. # Or:
  396. # AUTH_LDAP_USER_DN_TEMPLATE = 'uid=%(user)s,ou=users,dc=example,dc=com'
  397. # Set up the basic group parameters.
  398. AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
  399. "ou=groups,dc=ldap,dc=sharix,dc=ru",
  400. # "ou=apps,dc=ldap,dc=sharix,dc=ru",
  401. #TODO need to specify only django users
  402. ldap.SCOPE_SUBTREE,
  403. "(objectClass=groupOfNames)",
  404. )
  405. AUTH_LDAP_GROUP_TYPE = GroupOfNamesType(name_attr="cn")
  406. # Simple group restrictions
  407. #AUTH_LDAP_REQUIRE_GROUP = "cn=client,ou=groups,dc=ldap,dc=sharix,dc=ru"
  408. #AUTH_LDAP_REQUIRE_GROUP = "cn=django,ou=apps,dc=ldap,dc=sharix,dc=ru"
  409. #AUTH_LDAP_DENY_GROUP = "cn=disabled,ou=django,ou=groups,dc=example,dc=com"
  410. #AUTH_LDAP_DENY_GROUP = "cn=handlers,ou=apps,dc=ldap,dc=sharix,dc=ru"
  411. # TODO - it duplicates local lib for ldap, decide where it's better to be placed.
  412. #Most likely left side - Django, right side - LDAP
  413. # Populate the Django user from the LDAP directory.
  414. AUTH_LDAP_USER_ATTR_MAP = {
  415. "id": "uid",
  416. "password": "userPassword",
  417. "last_name": "sn",
  418. "middle_name": "initials",
  419. "first_name": "givenName",
  420. "email": "mail",
  421. "avatar": "jpegPhoto",
  422. "phone": "telephoneNumber",
  423. "username": "uid",
  424. }
  425. AUTH_LDAP_USER_FLAGS_BY_GROUP = {
  426. "is_active": [
  427. "cn=METASERVICE-ADMIN,ou=groups,dc=ldap,dc=sharix,dc=ru",
  428. "cn=METASERVICE-SUPERVISOR,ou=groups,dc=ldap,dc=sharix,dc=ru",
  429. "cn=METASERVICE-SUPPORT,ou=groups,dc=ldap,dc=sharix,dc=ru",
  430. "cn=METASERVICE-TECHSUPPORT,ou=groups,dc=ldap,dc=sharix,dc=ru",
  431. "cn=METASERVICE-CLIENT,ou=groups,dc=ldap,dc=sharix,dc=ru",
  432. "cn=django_admin,ou=groups,dc=ldap,dc=sharix,dc=ru",
  433. ],
  434. "is_staff": [
  435. #"cn=METASERVICE-ADMIN,ou=groups,dc=ldap,dc=sharix,dc=ru",
  436. #"cn=METASERVICE-SUPERVISOR,ou=groups,dc=ldap,dc=sharix,dc=ru",
  437. #"cn=METASERVICE-SUPPORT,ou=groups,dc=ldap,dc=sharix,dc=ru",
  438. "cn=METASERVICE-TECHSUPPORT,ou=groups,dc=ldap,dc=sharix,dc=ru",
  439. "cn=django_admin,ou=groups,dc=ldap,dc=sharix,dc=ru",
  440. ],
  441. "is_superuser": "cn=django_admin,ou=groups,dc=ldap,dc=sharix,dc=ru",
  442. }
  443. #AUTH_LDAP_REQUIRE_GROUP = (
  444. # LDAPGroupQuery("cn=client,ou=groups,dc=ldap,dc=sharix,dc=ru")
  445. # | LDAPGroupQuery("cn=platform_admin,ou=groups,dc=ldap,dc=sharix,dc=ru")
  446. #) & ~LDAPGroupQuery("cn=metaservice_admin,ou=groups,dc=ldap,dc=sharix,dc=ru")
  447. # This is the default, but I like to be explicit.
  448. AUTH_LDAP_ALWAYS_UPDATE_USER = True
  449. # Use LDAP group membership to calculate group permissions.
  450. AUTH_LDAP_FIND_GROUP_PERMS = True
  451. # Cache distinguished names and group memberships for an hour to minimize
  452. # LDAP traffic.
  453. AUTH_LDAP_CACHE_TIMEOUT = 3600
  454. AUTH_LDAP_MIRROR_GROUPS = True
  455. # Keep ModelBackend around for per-user permissions and maybe a local
  456. # superuser.
  457. AUTHENTICATION_BACKENDS = (
  458. "django_auth_ldap.backend.LDAPBackend",
  459. # "django.contrib.auth.backends.ModelBackend",
  460. )
  461. LOGGING = {
  462. 'version': 1,
  463. 'disable_existing_loggers': False,
  464. 'handlers': {
  465. 'file': {
  466. 'level': 'DEBUG',
  467. 'class': 'logging.FileHandler',
  468. 'filename': '/var/log/django-ldap.log',
  469. },
  470. },
  471. 'loggers': {
  472. 'django_auth_ldap': {
  473. 'handlers': ['file'],
  474. 'level': 'DEBUG',
  475. 'propagate': True,
  476. },
  477. },
  478. }