import ldap
lib/python3.4/site-packages/django_auth_ldap/config.py
?
DJANGO_SETTINGS_MODULE=local_settings ralph runserver ...
, where local_settings.py
is file with settings in your current dir. On top of this file you should place from ralph.settings.prod import *
chown -R ralph.ralph /opt/ralph
local-settings.py
from ralph.settings.prod import
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
LOGGING['loggers']['django_auth_ldap'] = {
'handlers': ['file'],
'propagate': True,
'level': 'DEBUG',
}
import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
AUTH_LDAP_SERVER_URI = "ldap://private.domain:389"
AUTH_LDAP_BIND_DN = "CN=bla,DC=private,DC=domain"
AUTH_LDAP_BIND_PASSWORD = "securepw"
AUTH_LDAP_PROTOCOL_VERSION = 3
AUTH_LDAP_USER_USERNAME_ATTR = "sAMAccountName"
AUTH_LDAP_USER_SEARCH_BASE = "OU=users,DC=private,DC=domain"
AUTH_LDAP_USER_SEARCH_FILTER = '(&(objectClass=)({0}=%(user)s))'.format(
AUTH_LDAP_USER_USERNAME_ATTR)
AUTH_LDAP_USER_SEARCH = LDAPSearch(AUTH_LDAP_USER_SEARCH_BASE,
ldap.SCOPE_SUBTREE, AUTH_LDAP_USER_SEARCH_FILTER)
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
"company": "company",
"manager": "manager",
"department": "department",
"employee_id": "employeeID",
"location": "officeName",
"country": "ISO-country-code",
}
export DATABASE_NAME=ralph
export DATABASE_USER=ralph
export DATABASE_PASSWORD=blabla
export DATABASE_HOST=localhost
export PATH=/opt/ralph/ralph-core/bin/:$PATH
export RALPH_DEBUG=1
export DJANGO_SETTINGS_MODULE=local_settings
ralph runserver 0.0.0.0:8000
ImportError: No module named 'local_settings'
/opt/ralph/ralph-core/lib/python3.4/site-packages/django/conf/
?
ralph.my.domain:8000
but https://ralph.my.domain
what you have to do is something like that: in nginx conf you define server for port 80. In there you create
return 301 https://$server_name$request_uri;
and in second the server section for 443 you create a section
location / {
proxy_pass http://ralph.my.domain:8000;
}