source: publico/SIGI/trunk/sigi/settings.py @ 5359

Última Alteração nesse arquivo desde 5359 foi 5359, incluída por felipevieira, 8 anos atrás

Merge branch 'ldap'

  • Propriedade svn:eol-style mudada para native
  • Propriedade svn:keywords mudada para Date Revision Author HeadURL Id
File size: 5.1 KB
Linha 
1# coding= utf-8
2#
3# Default Django settings for SIGI.
4#
5#   (!!!)
6#
7#   DON'T CHANGE THIS FILE, USE local_settings.py. YOU GET A TEMPLATE IN
8#   local_settings.template (COPY HIM TO local_settings.py AND MAKE YOUR
9#   NECESSARY CHANGES.
10#
11
12import os
13import ldap
14import logging
15
16from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
17
18BASE_DIR = os.path.abspath(os.path.dirname(__file__) + '../..')
19PROJECT_DIR = BASE_DIR + '/sigi'
20
21DEBUG = True
22TEMPLATE_DEBUG = DEBUG
23
24# I can't determine this, use local_settings.py.
25ADMINS = (('root', 'root@localhost'),)
26MANAGERS = ADMINS
27SERVER_EMAIL = 'root@localhost'
28DEFAULT_FROM_EMAIL = 'noreply@localhost'
29
30INTERNAL_IPS = ('127.0.0.1',)
31
32DATABASE_ENGINE = 'postgresql_psycopg2'
33#DATABASE_ENGINE = 'sqlite3'
34DATABASE_NAME = 'sigi'
35DATABASE_USER = 'administrador'
36DATABASE_PASSWORD = 'interlegis'
37DATABASE_HOST = '10.1.10.44'
38DATABASE_PORT = '5432'
39
40TIME_ZONE = 'Brazil/East'
41LANGUAGE_CODE = 'pt-br'
42DEFAULT_CHARSET = 'utf-8'
43SITE_ID = 1
44
45USE_I18N = True
46USE_L10N = True
47
48MEDIA_ROOT = BASE_DIR + '/media/'
49MEDIA_URL = '/sigi/media/'
50ADMIN_MEDIA_PREFIX = '/sigi/admin_media/'
51
52# Baseline configuration.
53AUTH_LDAP_SERVER_URI = "ldap://w2k3dc01.interlegis.gov.br"
54AUTH_LDAP_BIND_DN = u"cn=sigi-ldap,ou=Usuários de Sistema,ou=Usuários,ou=Interlegis,dc=interlegis,dc=gov,dc=br"
55AUTH_LDAP_BIND_PASSWORD = "Sigi2609"
56AUTH_LDAP_USER_SEARCH = LDAPSearch(u"ou=SINTER,ou=Usuários,ou=Sede,dc=interlegis,dc=gov,dc=br", ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)")
57
58# Set up the basic group parameters.
59AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Grupos Organizacionais,ou=Sede,dc=interlegis,dc=gov,dc=br", ldap.SCOPE_SUBTREE, "(objectClass=Group)")
60AUTH_LDAP_GROUP_TYPE = GroupOfNamesType(name_attr="cn")
61
62# Only users in this group can log in.
63#AUTH_LDAP_REQUIRE_GROUP = u"cn=Acesso ao SIGI,ou=Grupos de Permissão,ou=Sede,dc=interlegis,dc=gov,dc=br"
64
65AUTH_LDAP_USER_FLAGS_BY_GROUP = {
66  "is_staff": u"cn=Acesso ao SIGI,ou=Grupos de Permissão,ou=Sede,dc=interlegis,dc=gov,dc=br"
67}
68
69# Populate the Django user from the LDAP directory.
70AUTH_LDAP_USER_ATTR_MAP = {
71  "first_name": "givenName",
72  "last_name": "sn",
73  "email": "userPrincipalName"
74}
75
76# Populate the Django user_profile from the LDAP directory.
77#AUTH_LDAP_PROFILE_ATTR_MAP = {
78#  "employee_number": "employeeNumber"
79#}
80
81#AUTH_LDAP_PROFILE_FLAGS_BY_GROUP = {
82#  "is_awesome": "cn=awesome,ou=django,ou=groups,dc=example,dc=com",
83#}
84
85# Use LDAP group membership to calculate group permissions.
86AUTH_LDAP_FIND_GROUP_PERMS = True
87AUTH_LDAP_MIRROR_GROUPS = True
88
89# Cache group memberships for an hour to minimize LDAP traffic
90AUTH_LDAP_CACHE_GROUPS = True
91AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600
92
93# Keep ModelBackend around for per-user permissions and maybe a local superuser.
94AUTHENTICATION_BACKENDS = (
95    'django_auth_ldap.backend.LDAPBackend',
96    'django.contrib.auth.backends.ModelBackend',
97)
98
99CACHE_BACKEND = 'dummy:///'
100CACHE_MIDDLEWARE_SECONDS = 60
101CACHE_MIDDLEWARE_KEY_PREFIX = 'sigi'
102CACHE_MIDDLEWARE_ANONYMOUS_ONLY = False
103
104# Used to provide a seed in secret-key hashing algorithms. Set this to
105# a random string in your local_settings.py - the longer, the better.
106SECRET_KEY = 'set-this-in-your-local_settings.py!'
107
108# List of callables that know how to import templates from various sources.
109TEMPLATE_LOADERS = (
110    'django.template.loaders.filesystem.load_template_source',
111    'django.template.loaders.app_directories.load_template_source',
112)
113
114TEMPLATE_CONTEXT_PROCESSORS = (
115    'django.core.context_processors.auth',
116    'django.core.context_processors.debug',
117    'django.core.context_processors.i18n',
118    'django.core.context_processors.media',
119    'sigi.context_processors.charts_data',
120)
121
122MIDDLEWARE_CLASSES = (
123    'django.middleware.http.ConditionalGetMiddleware',
124    'django.middleware.gzip.GZipMiddleware',
125    'django.contrib.sessions.middleware.SessionMiddleware',
126    'django.contrib.auth.middleware.AuthenticationMiddleware',
127    'django.middleware.cache.CacheMiddleware',
128    'django.middleware.common.CommonMiddleware',
129    'django.middleware.doc.XViewMiddleware',
130)
131
132ROOT_URLCONF = 'sigi.urls'
133
134TEMPLATE_DIRS = (
135    PROJECT_DIR + '/templates',
136)
137
138FIXTURE_DIRS = (PROJECT_DIR + '/fixtures',)
139
140INSTALLED_APPS = (
141    'django.contrib.auth',
142    'django.contrib.contenttypes',
143    'django.contrib.sessions',
144    'django.contrib.sites',
145    'django.contrib.admin',
146    'django_extensions',      # http://django-command-extensions.googlecode.com
147    'googlecharts',           # http://github.com/jacobian/django-googlecharts
148    'treemenus',              # http://django-treemenus.googlecode.com
149    'reporting',              # http://github.com/marinho/geraldo
150    'sigi.apps.casas',
151    'sigi.apps.contatos',
152    'sigi.apps.convenios',
153    'sigi.apps.inventario',
154    'sigi.apps.mesas',
155    'sigi.apps.parlamentares',
156    'sigi.apps.servicos',
157    'sigi.apps.relatorios',
158)
159
160try:
161    from local_settings import *
162except ImportError:
163    from warnings import warn
164    msg = "You don't have local_settings.py file, using defaults settings."
165    try:
166        # don't work in Python 2.4 or before
167        warn(msg, category=ImportWarning)
168    except NameError:
169        warn(msg)
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.