Browse Source

Merge branch 'master' of git.someserver.de:k4ever

Sebastian Lohff 9 years ago
parent
commit
b82053d797
3 changed files with 86 additions and 25 deletions
  1. 1
    0
      .gitignore
  2. 79
    0
      k4ever/settings.py.template
  3. 6
    25
      k4ever/settings_default.py

+ 1
- 0
.gitignore View File

@@ -7,5 +7,6 @@
7 7
 *~
8 8
 k4ever/k4ever.db
9 9
 k4ever/media/img/
10
+k4ever/settings.py
10 11
 *.kdev4
11 12
 .kdev4

+ 79
- 0
k4ever/settings.py.template View File

@@ -0,0 +1,79 @@
1
+# Django settings for k4ever project.
2
+from settings_default import *
3
+
4
+# Debug settings
5
+DEBUG = True
6
+TEMPLATE_DEBUG = DEBUG
7
+PISTON_DISPLAY_ERRORS = DEBUG
8
+DEBUG_PROPOGATE_EXCEPTIONS = DEBUG
9
+
10
+
11
+# When DEBUG = False, exceptions will be mailed to these people
12
+ADMINS = (
13
+    # ('Your Name', 'your_email@domain.com'),
14
+)
15
+
16
+MANAGERS = ADMINS
17
+
18
+DATABASES = {
19
+    'default': {
20
+        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
21
+        'NAME': 'k4ever.db',                      # Or path to database file if using sqlite3.
22
+        'USER': '',                      # Not used with sqlite3.
23
+        'PASSWORD': '',                  # Not used with sqlite3.
24
+        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
25
+        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
26
+    }
27
+}
28
+
29
+# Local time zone for this installation. Choices can be found here:
30
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
31
+# although not all choices may be available on all operating systems.
32
+# On Unix systems, a value of None will cause Django to use the same
33
+# timezone as the operating system.
34
+# If running in a Windows environment this must be set to the same as your
35
+# system time zone.
36
+TIME_ZONE = 'Europe/Berlin'
37
+
38
+# Language code for this installation. All choices can be found here:
39
+# http://www.i18nguy.com/unicode/language-identifiers.html
40
+LANGUAGE_CODE = 'de-de'
41
+
42
+# Make this unique, and don't share it with anybody. This is used for hash
43
+# generation and other stuff. MUST BE SET.
44
+SECRET_KEY = ''
45
+
46
+# LDAP configuration
47
+USE_LDAP = False
48
+if USE_LDAP:
49
+	
50
+	# For more information about the LDAP backend look the docs for
51
+	# django-auth-ldap - http://packages.python.org/django-auth-ldap/
52
+	AUTH_LDAP_SERVER_URI = 'ldaps://your.server'
53
+	AUTH_LDAP_START_TLS = False
54
+	AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=example,dc=com"
55
+	AUTH_LDAP_USER_ATTR_MAP = {
56
+		"first_name": "givenName",
57
+		"last_name": "sn",
58
+		"email": "mail"
59
+	}
60
+	## Uncomment these lines, if the certificate of your ldap(s) is not in
61
+	## your local certificate store (e.g. /etc/ssl/)
62
+	# import ldap
63
+	#AUTH_LDAP_GLOBAL_OPTIONS = {ldap.OPT_X_TLS_CACERTFILE: "data/cacert.txt"}
64
+
65
+	## Uncomment this, if you want ldap privileges mapped onto django's
66
+	#AUTH_LDAP_USER_FLAGS_BY_GROUP = {
67
+	##	"is_active": "cn=active,ou=groups,dc=example,dc=com",
68
+	#	"is_staff": "cn=staff,ou=groups,dc=example,dc=com",
69
+	#	"is_superuser": "cn=superuser,ou=groups,dc=example,dc=com"
70
+	#}
71
+	
72
+	# Add LDAP to authentication backends (needs to be first in the list)
73
+	AUTHENTICATION_BACKENDS = ('django_auth_ldap.backend.LDAPBackend',) \
74
+	                           + AUTHENTICATION_BACKENDS
75
+
76
+if not SECRET_KEY or SECRET_KEY == '':
77
+	from django.core.exceptions import ImproperlyConfigured
78
+	raise ImproperlyConfigured("Please set a SECRET_KEY in your settings.py")
79
+

k4ever/settings.py → k4ever/settings_default.py View File

@@ -1,11 +1,9 @@
1 1
 # Django settings for k4ever project.
2 2
 
3
-import ldap
4
-
5
-DEBUG = True
3
+DEBUG = False
6 4
 TEMPLATE_DEBUG = DEBUG
7 5
 PISTON_DISPLAY_ERRORS = DEBUG
8
-DEBUG_PROPOGATE_EXCEPTIONS = True
6
+DEBUG_PROPOGATE_EXCEPTIONS = DEBUG
9 7
 
10 8
 ADMINS = (
11 9
     # ('Your Name', 'your_email@domain.com'),
@@ -13,6 +11,7 @@ ADMINS = (
13 11
 
14 12
 MANAGERS = ADMINS
15 13
 
14
+# use sqlite by default
16 15
 DATABASES = {
17 16
     'default': {
18 17
         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
@@ -62,7 +61,8 @@ MEDIA_URL = '/media/'
62 61
 ADMIN_MEDIA_PREFIX = '/media/admin/'
63 62
 
64 63
 # Make this unique, and don't share it with anybody.
65
-SECRET_KEY = 'l(f*a$l)_n_n_5#lh@rvhv(na^!lj1u#bow=c!*90(1w$5%b^j'
64
+# As we want this different on every system, it is commented out here.
65
+# SECRET_KEY = 'l(f*a$l)_n_n_5#lh@rvhv(na^!lj1u#bow=c!*90(1w$5%b^j'
66 66
 
67 67
 
68 68
 ################################
@@ -73,33 +73,14 @@ LOGIN_URL = '/user/login/'
73 73
 LOGIN_REDIRECT_URL = '/'
74 74
 
75 75
 AUTHENTICATION_BACKENDS = (
76
-#	'main.backend.CustomLDAPBackend',
77
-	'django_auth_ldap.backend.LDAPBackend',
78 76
 	'django.contrib.auth.backends.ModelBackend',
79 77
 )
80 78
 
81
-# ldap section
82
-AUTH_LDAP_SERVER_URI = 'ldaps://chef.freitagsrunde.org'
83
-AUTH_LDAP_START_TLS = False # we already use LDAPS
84
-AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=freitagsrunde,dc=org"
85
-AUTH_LDAP_USER_ATTR_MAP = {"first_name": "givenName", "last_name": "sn", "email": "mail"}
86
-AUTH_LDAP_GLOBAL_OPTIONS = {ldap.OPT_X_TLS_CACERTFILE: "data/cacert.txt"}
87
-
88
-## Nur ein Beispiel, falls technik@ automatisch admin der Kasse werden soll.
89
-#AUTH_LDAP_USER_FLAGS_BY_GROUP = {
90
-##	"is_active": "cn=active,ou=groups,dc=example,dc=com",
91
-#	"is_staff": "cn=staff,ou=groups,dc=example,dc=com",
92
-#	"is_superuser": "cn=superuser,ou=groups,dc=example,dc=com"
93
-#}
94
-
95
-
96
-
97 79
 # List of callables that know how to import templates from various sources.
98 80
 TEMPLATE_LOADERS = (
99 81
     'django.template.loaders.filesystem.Loader',
100 82
     'django.template.loaders.app_directories.Loader',
101 83
 	'django.template.loaders.app_directories.load_template_source',
102
-#     'django.template.loaders.eggs.Loader',
103 84
 )
104 85
 
105 86
 MIDDLEWARE_CLASSES = (
@@ -127,7 +108,7 @@ INSTALLED_APPS = (
127 108
 	'buyable',
128 109
 	'transaction',
129 110
 	'main',
130
-    # Uncomment the next line to enable the admin:
131 111
     'django.contrib.admin',
132 112
     'easy_thumbnails',
133 113
 )
114
+

Loading…
Cancel
Save