Advertisement
SntPx

django_settings

Nov 13th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.81 KB | None | 0 0
  1. """
  2. Django settings for westeros0 project.
  3.  
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/1.6/topics/settings/
  6.  
  7. For the full list of settings and their values, see
  8. https://docs.djangoproject.com/en/1.6/ref/settings/
  9. """
  10.  
  11. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  12. import os, ldap
  13. from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
  14. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  15.  
  16.  
  17. # Quick-start development settings - unsuitable for production
  18. # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
  19.  
  20. # SECURITY WARNING: keep the secret key used in production secret!
  21. SECRET_KEY = '&1jxtf1m6l8(j-d3!dlo$#x4$#ow7vfx7@z&==9b_=s_trdo(-'
  22.  
  23. # SECURITY WARNING: don't run with debug turned on in production!
  24. DEBUG = True
  25.  
  26. TEMPLATE_DEBUG = True
  27.  
  28. ALLOWED_HOSTS = []
  29.  
  30.  
  31. # Application definition
  32.  
  33. INSTALLED_APPS = (
  34.     'django.contrib.admin',
  35.     'django.contrib.auth',
  36.     'django.contrib.contenttypes',
  37.     'django.contrib.sessions',
  38.     'django.contrib.messages',
  39.     'django.contrib.staticfiles',
  40.     'django.contrib.admin',
  41.     'authApp',
  42. )
  43.  
  44. MIDDLEWARE_CLASSES = (
  45.     'django.contrib.sessions.middleware.SessionMiddleware',
  46.     'django.middleware.common.CommonMiddleware',
  47.     'django.middleware.csrf.CsrfViewMiddleware',
  48.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  49.     'django.contrib.messages.middleware.MessageMiddleware',
  50.     'django.middleware.clickjacking.XFrameOptionsMiddleware',
  51. )
  52.  
  53. ROOT_URLCONF = 'westeros0.urls'
  54.  
  55. WSGI_APPLICATION = 'westeros0.wsgi.application'
  56.  
  57.  
  58. # Database
  59. # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
  60.  
  61. DATABASES = {
  62.     'default': {
  63.         'ENGINE': 'django.db.backends.sqlite3',
  64.         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  65.     },
  66.     'ldap': {
  67.         'ENGINE': 'ldapdb.backends.ldap',
  68.         'NAME': 'ldap://127.0.0.1',
  69.         'HOST': '127.0.0.1',
  70.         'PORT': '389',
  71.         'USER': '**********',
  72.         'PASSWORD': '**********',
  73.     }
  74. }
  75.  
  76. # LDAP global Config
  77. AUTHENTICATION_BACKENDS = (
  78.     'django_auth_ldap.backend.LDAPBackend',
  79.     'django.contrib.auth.backends.ModelBackend',
  80. )
  81.  
  82. AUTH_LDAP_BIND_DN = DATABASES['ldap']['USER']
  83. AUTH_LDAP_BIND_PASSWORD = DATABASES['ldap']['PASSWORD']
  84. AUTH_LDAP_USER_SEARCH = LDAPSearch("o=customers, dc=velch, dc=local", ldap.SCOPE_SUBTREE, "uid=%(user)s")
  85.  
  86. #AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=groups, o=customers, dc=velch, dc=local",
  87.  #                                   ldap.SCOPE_SUBTREE, "(objectClass=groupOfNames)")
  88. #AUTH_LDAP_GROUP_TYPE = GroupOfNamesType()
  89.  
  90.  
  91. # Internationalization
  92. # https://docs.djangoproject.com/en/1.6/topics/i18n/
  93.  
  94. LANGUAGE_CODE = 'en-us'
  95.  
  96. TIME_ZONE = 'UTC'
  97.  
  98. USE_I18N = True
  99.  
  100. USE_L10N = True
  101.  
  102. USE_TZ = True
  103.  
  104.  
  105. # Static files (CSS, JavaScript, Images)
  106. # https://docs.djangoproject.com/en/1.6/howto/static-files/
  107.  
  108. STATIC_URL = '/static/'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement