root / mupy / settings.py @ caeb8833
History | View | Annotate | Download (5 kB)
1 | caeb8833 | Stauros Kroustouris | # Django settings for mupy project.
|
---|---|---|---|
2 | caeb8833 | Stauros Kroustouris | import os |
3 | caeb8833 | Stauros Kroustouris | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) |
4 | caeb8833 | Stauros Kroustouris | PROJECT_DIR = os.path.join(BASE_DIR, 'mupy')
|
5 | caeb8833 | Stauros Kroustouris | PUBLIC_DIR = os.path.join(BASE_DIR, 'public')
|
6 | caeb8833 | Stauros Kroustouris | |
7 | caeb8833 | Stauros Kroustouris | DEBUG = True
|
8 | caeb8833 | Stauros Kroustouris | TEMPLATE_DEBUG = DEBUG |
9 | caeb8833 | Stauros Kroustouris | |
10 | caeb8833 | Stauros Kroustouris | ADMINS = ( |
11 | caeb8833 | Stauros Kroustouris | ('Stavros Kroustouris', 'staurosk@noc.grnet.gr'), |
12 | caeb8833 | Stauros Kroustouris | ) |
13 | caeb8833 | Stauros Kroustouris | |
14 | caeb8833 | Stauros Kroustouris | MANAGERS = ADMINS |
15 | caeb8833 | Stauros Kroustouris | |
16 | caeb8833 | Stauros Kroustouris | DATABASES = { |
17 | caeb8833 | Stauros Kroustouris | 'default': {
|
18 | caeb8833 | Stauros Kroustouris | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. |
19 | caeb8833 | Stauros Kroustouris | 'NAME': 'mupy', # Or path to database file if using sqlite3. |
20 | caeb8833 | Stauros Kroustouris | 'USER': '', # Not used with sqlite3. |
21 | caeb8833 | Stauros Kroustouris | 'PASSWORD': '', # Not used with sqlite3. |
22 | caeb8833 | Stauros Kroustouris | 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. |
23 | caeb8833 | Stauros Kroustouris | 'PORT': '', # Set to empty string for default. Not used with sqlite3. |
24 | caeb8833 | Stauros Kroustouris | } |
25 | caeb8833 | Stauros Kroustouris | } |
26 | caeb8833 | Stauros Kroustouris | |
27 | caeb8833 | Stauros Kroustouris | # Local time zone for this installation. Choices can be found here:
|
28 | caeb8833 | Stauros Kroustouris | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
29 | caeb8833 | Stauros Kroustouris | # although not all choices may be available on all operating systems.
|
30 | caeb8833 | Stauros Kroustouris | # In a Windows environment this must be set to your system time zone.
|
31 | caeb8833 | Stauros Kroustouris | TIME_ZONE = 'America/Chicago'
|
32 | caeb8833 | Stauros Kroustouris | |
33 | caeb8833 | Stauros Kroustouris | # Language code for this installation. All choices can be found here:
|
34 | caeb8833 | Stauros Kroustouris | # http://www.i18nguy.com/unicode/language-identifiers.html
|
35 | caeb8833 | Stauros Kroustouris | LANGUAGE_CODE = 'en-us'
|
36 | caeb8833 | Stauros Kroustouris | |
37 | caeb8833 | Stauros Kroustouris | SITE_ID = 1
|
38 | caeb8833 | Stauros Kroustouris | |
39 | caeb8833 | Stauros Kroustouris | # If you set this to False, Django will make some optimizations so as not
|
40 | caeb8833 | Stauros Kroustouris | # to load the internationalization machinery.
|
41 | caeb8833 | Stauros Kroustouris | USE_I18N = True
|
42 | caeb8833 | Stauros Kroustouris | |
43 | caeb8833 | Stauros Kroustouris | # If you set this to False, Django will not format dates, numbers and
|
44 | caeb8833 | Stauros Kroustouris | # calendars according to the current locale.
|
45 | caeb8833 | Stauros Kroustouris | USE_L10N = True
|
46 | caeb8833 | Stauros Kroustouris | |
47 | caeb8833 | Stauros Kroustouris | # If you set this to False, Django will not use timezone-aware datetimes.
|
48 | caeb8833 | Stauros Kroustouris | USE_TZ = True
|
49 | caeb8833 | Stauros Kroustouris | |
50 | caeb8833 | Stauros Kroustouris | |
51 | caeb8833 | Stauros Kroustouris | # Static files (CSS, JavaScript, Images)
|
52 | caeb8833 | Stauros Kroustouris | # https://docs.djangoproject.com/en/1.6/howto/static-files/
|
53 | caeb8833 | Stauros Kroustouris | MEDIA_ROOT = os.path.join(PUBLIC_DIR, 'media')
|
54 | caeb8833 | Stauros Kroustouris | STATIC_ROOT = os.path.join(PUBLIC_DIR, 'static')
|
55 | caeb8833 | Stauros Kroustouris | STATICFILES_DIRS = [ |
56 | caeb8833 | Stauros Kroustouris | os.path.join(PROJECT_DIR, 'static'),
|
57 | caeb8833 | Stauros Kroustouris | ] |
58 | caeb8833 | Stauros Kroustouris | |
59 | caeb8833 | Stauros Kroustouris | |
60 | caeb8833 | Stauros Kroustouris | # List of finder classes that know how to find static files in
|
61 | caeb8833 | Stauros Kroustouris | # various locations.
|
62 | caeb8833 | Stauros Kroustouris | STATICFILES_FINDERS = ( |
63 | caeb8833 | Stauros Kroustouris | 'django.contrib.staticfiles.finders.FileSystemFinder',
|
64 | caeb8833 | Stauros Kroustouris | 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
65 | caeb8833 | Stauros Kroustouris | # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
66 | caeb8833 | Stauros Kroustouris | ) |
67 | caeb8833 | Stauros Kroustouris | |
68 | caeb8833 | Stauros Kroustouris | # List of callables that know how to import templates from various sources.
|
69 | caeb8833 | Stauros Kroustouris | TEMPLATE_LOADERS = ( |
70 | caeb8833 | Stauros Kroustouris | 'django.template.loaders.filesystem.Loader',
|
71 | caeb8833 | Stauros Kroustouris | 'django.template.loaders.app_directories.Loader',
|
72 | caeb8833 | Stauros Kroustouris | # 'django.template.loaders.eggs.Loader',
|
73 | caeb8833 | Stauros Kroustouris | ) |
74 | caeb8833 | Stauros Kroustouris | |
75 | caeb8833 | Stauros Kroustouris | MIDDLEWARE_CLASSES = ( |
76 | caeb8833 | Stauros Kroustouris | 'django.middleware.cache.UpdateCacheMiddleware',
|
77 | caeb8833 | Stauros Kroustouris | 'django.middleware.gzip.GZipMiddleware',
|
78 | caeb8833 | Stauros Kroustouris | 'django.middleware.common.CommonMiddleware',
|
79 | caeb8833 | Stauros Kroustouris | 'django.contrib.sessions.middleware.SessionMiddleware',
|
80 | caeb8833 | Stauros Kroustouris | 'django.middleware.csrf.CsrfViewMiddleware',
|
81 | caeb8833 | Stauros Kroustouris | 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
82 | caeb8833 | Stauros Kroustouris | 'django.contrib.messages.middleware.MessageMiddleware',
|
83 | caeb8833 | Stauros Kroustouris | # Uncomment the next line for simple clickjacking protection:
|
84 | caeb8833 | Stauros Kroustouris | # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
85 | caeb8833 | Stauros Kroustouris | ) |
86 | caeb8833 | Stauros Kroustouris | |
87 | caeb8833 | Stauros Kroustouris | |
88 | caeb8833 | Stauros Kroustouris | ROOT_URLCONF = 'mupy.urls'
|
89 | caeb8833 | Stauros Kroustouris | |
90 | caeb8833 | Stauros Kroustouris | # Python dotted path to the WSGI application used by Django's runserver.
|
91 | caeb8833 | Stauros Kroustouris | WSGI_APPLICATION = 'mupy.wsgi.application'
|
92 | caeb8833 | Stauros Kroustouris | |
93 | caeb8833 | Stauros Kroustouris | TEMPLATE_DIRS = [ |
94 | caeb8833 | Stauros Kroustouris | os.path.join(PROJECT_DIR, 'templates'),
|
95 | caeb8833 | Stauros Kroustouris | ] |
96 | caeb8833 | Stauros Kroustouris | |
97 | caeb8833 | Stauros Kroustouris | INSTALLED_APPS = ( |
98 | caeb8833 | Stauros Kroustouris | 'django.contrib.auth',
|
99 | caeb8833 | Stauros Kroustouris | 'django.contrib.contenttypes',
|
100 | caeb8833 | Stauros Kroustouris | 'django.contrib.sessions',
|
101 | caeb8833 | Stauros Kroustouris | 'django.contrib.sites',
|
102 | caeb8833 | Stauros Kroustouris | 'django.contrib.messages',
|
103 | caeb8833 | Stauros Kroustouris | 'django.contrib.staticfiles',
|
104 | caeb8833 | Stauros Kroustouris | 'django.contrib.admin',
|
105 | caeb8833 | Stauros Kroustouris | |
106 | caeb8833 | Stauros Kroustouris | # third party
|
107 | caeb8833 | Stauros Kroustouris | 'south',
|
108 | caeb8833 | Stauros Kroustouris | |
109 | caeb8833 | Stauros Kroustouris | # first party
|
110 | caeb8833 | Stauros Kroustouris | 'muparse',
|
111 | caeb8833 | Stauros Kroustouris | 'accounts',
|
112 | caeb8833 | Stauros Kroustouris | ) |
113 | caeb8833 | Stauros Kroustouris | |
114 | caeb8833 | Stauros Kroustouris | AUTH_PROFILE_MODULE = 'accounts.UserProfile'
|
115 | caeb8833 | Stauros Kroustouris | |
116 | caeb8833 | Stauros Kroustouris | CACHE_BACKEND = ''
|
117 | caeb8833 | Stauros Kroustouris | MUNIN_NODES = ( |
118 | caeb8833 | Stauros Kroustouris | ( |
119 | caeb8833 | Stauros Kroustouris | 1, {
|
120 | caeb8833 | Stauros Kroustouris | 'name': 'example1', |
121 | caeb8833 | Stauros Kroustouris | 'url': 'http://one.example.com', |
122 | caeb8833 | Stauros Kroustouris | 'cgi_path': 'cgi-bin/munin-cgi-graph/', |
123 | caeb8833 | Stauros Kroustouris | 'image_path': '' |
124 | caeb8833 | Stauros Kroustouris | } |
125 | caeb8833 | Stauros Kroustouris | ), |
126 | caeb8833 | Stauros Kroustouris | ( |
127 | caeb8833 | Stauros Kroustouris | 2, {
|
128 | caeb8833 | Stauros Kroustouris | 'name': 'example2', |
129 | caeb8833 | Stauros Kroustouris | 'url': 'http://two.example.com', |
130 | caeb8833 | Stauros Kroustouris | 'cgi_path': 'cgi-bin/munin-cgi-graph/', |
131 | caeb8833 | Stauros Kroustouris | 'image_path': '' |
132 | caeb8833 | Stauros Kroustouris | } |
133 | caeb8833 | Stauros Kroustouris | ), |
134 | caeb8833 | Stauros Kroustouris | ) |
135 | caeb8833 | Stauros Kroustouris | |
136 | caeb8833 | Stauros Kroustouris | MUNIN_URL = "http://munin.example.com"
|
137 | caeb8833 | Stauros Kroustouris | #MUNIN_URL = "http://munin.ping.uio.no"
|
138 | caeb8833 | Stauros Kroustouris | MUNIN_CGI_PATH = "cgi-bin/munin-cgi-graph/"
|
139 | caeb8833 | Stauros Kroustouris | #MUNIN_CGI_PATH = ""
|
140 | caeb8833 | Stauros Kroustouris | MUNIN_IMAGE_PATH = ""
|
141 | caeb8833 | Stauros Kroustouris | #CACHE_BACKEND = 'dummy://'
|
142 | caeb8833 | Stauros Kroustouris | |
143 | caeb8833 | Stauros Kroustouris | LDAP_AUTH_SETTINGS = ( |
144 | caeb8833 | Stauros Kroustouris | { |
145 | caeb8833 | Stauros Kroustouris | 'url': 'ldap://ldap.example.com/', |
146 | caeb8833 | Stauros Kroustouris | 'base': 'dc=dc,dc=example,dc=com' |
147 | caeb8833 | Stauros Kroustouris | }, |
148 | caeb8833 | Stauros Kroustouris | ) |
149 | caeb8833 | Stauros Kroustouris | # If defined as a string new users will belong in this group. Group must exist
|
150 | caeb8833 | Stauros Kroustouris | LDAP_AUTH_GROUP = None
|
151 | caeb8833 | Stauros Kroustouris | # Whether new users will have admin access
|
152 | caeb8833 | Stauros Kroustouris | LDAP_AUTH_IS_STAFF = False
|
153 | caeb8833 | Stauros Kroustouris | |
154 | caeb8833 | Stauros Kroustouris | |
155 | caeb8833 | Stauros Kroustouris | def _dictmerge(a, b): |
156 | caeb8833 | Stauros Kroustouris | """ deep merge two dictionaries """
|
157 | caeb8833 | Stauros Kroustouris | ret = dict(a.items() + b.items())
|
158 | caeb8833 | Stauros Kroustouris | for key in set(a.keys()) & set(b.keys()): |
159 | caeb8833 | Stauros Kroustouris | if isinstance(a[key], dict) and isinstance(b[key], dict): |
160 | caeb8833 | Stauros Kroustouris | ret[key] = _dictmerge(a[key], b[key]) |
161 | caeb8833 | Stauros Kroustouris | return ret
|
162 | caeb8833 | Stauros Kroustouris | |
163 | caeb8833 | Stauros Kroustouris | from local_settings import * # noqa |
164 | caeb8833 | Stauros Kroustouris | for var, val in [i for i in locals().items() if i[0].startswith('EXTRA_')]: |
165 | caeb8833 | Stauros Kroustouris | name = var[len('EXTRA_'):] |
166 | caeb8833 | Stauros Kroustouris | try:
|
167 | caeb8833 | Stauros Kroustouris | locals()[name] += val # append list |
168 | caeb8833 | Stauros Kroustouris | except TypeError: |
169 | caeb8833 | Stauros Kroustouris | locals()[name] = _dictmerge(locals()[name], val) # merge dict |