Statistics
| Branch: | Tag: | Revision:

root / mupy / settings.py @ caeb8833

History | View | Annotate | Download (5 kB)

1
# Django settings for mupy project.
2
import os
3
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
4
PROJECT_DIR = os.path.join(BASE_DIR, 'mupy')
5
PUBLIC_DIR = os.path.join(BASE_DIR, 'public')
6

    
7
DEBUG = True
8
TEMPLATE_DEBUG = DEBUG
9

    
10
ADMINS = (
11
    ('Stavros Kroustouris', 'staurosk@noc.grnet.gr'),
12
)
13

    
14
MANAGERS = ADMINS
15

    
16
DATABASES = {
17
    'default': {
18
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
19
        'NAME': 'mupy',                      # Or path to database file if using sqlite3.
20
        'USER': '',                      # Not used with sqlite3.
21
        'PASSWORD': '',                  # Not used with sqlite3.
22
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
23
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
24
    }
25
}
26

    
27
# Local time zone for this installation. Choices can be found here:
28
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
29
# although not all choices may be available on all operating systems.
30
# In a Windows environment this must be set to your system time zone.
31
TIME_ZONE = 'America/Chicago'
32

    
33
# Language code for this installation. All choices can be found here:
34
# http://www.i18nguy.com/unicode/language-identifiers.html
35
LANGUAGE_CODE = 'en-us'
36

    
37
SITE_ID = 1
38

    
39
# If you set this to False, Django will make some optimizations so as not
40
# to load the internationalization machinery.
41
USE_I18N = True
42

    
43
# If you set this to False, Django will not format dates, numbers and
44
# calendars according to the current locale.
45
USE_L10N = True
46

    
47
# If you set this to False, Django will not use timezone-aware datetimes.
48
USE_TZ = True
49

    
50

    
51
# Static files (CSS, JavaScript, Images)
52
# https://docs.djangoproject.com/en/1.6/howto/static-files/
53
MEDIA_ROOT = os.path.join(PUBLIC_DIR, 'media')
54
STATIC_ROOT = os.path.join(PUBLIC_DIR, 'static')
55
STATICFILES_DIRS = [
56
    os.path.join(PROJECT_DIR, 'static'),
57
]
58

    
59

    
60
# List of finder classes that know how to find static files in
61
# various locations.
62
STATICFILES_FINDERS = (
63
    'django.contrib.staticfiles.finders.FileSystemFinder',
64
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
65
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
66
)
67

    
68
# List of callables that know how to import templates from various sources.
69
TEMPLATE_LOADERS = (
70
    'django.template.loaders.filesystem.Loader',
71
    'django.template.loaders.app_directories.Loader',
72
#     'django.template.loaders.eggs.Loader',
73
)
74

    
75
MIDDLEWARE_CLASSES = (
76
    'django.middleware.cache.UpdateCacheMiddleware',
77
    'django.middleware.gzip.GZipMiddleware',
78
    'django.middleware.common.CommonMiddleware',
79
    'django.contrib.sessions.middleware.SessionMiddleware',
80
    'django.middleware.csrf.CsrfViewMiddleware',
81
    'django.contrib.auth.middleware.AuthenticationMiddleware',
82
    'django.contrib.messages.middleware.MessageMiddleware',
83
    # Uncomment the next line for simple clickjacking protection:
84
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
85
)
86

    
87

    
88
ROOT_URLCONF = 'mupy.urls'
89

    
90
# Python dotted path to the WSGI application used by Django's runserver.
91
WSGI_APPLICATION = 'mupy.wsgi.application'
92

    
93
TEMPLATE_DIRS = [
94
    os.path.join(PROJECT_DIR, 'templates'),
95
]
96

    
97
INSTALLED_APPS = (
98
    'django.contrib.auth',
99
    'django.contrib.contenttypes',
100
    'django.contrib.sessions',
101
    'django.contrib.sites',
102
    'django.contrib.messages',
103
    'django.contrib.staticfiles',
104
    'django.contrib.admin',
105

    
106
    # third party
107
    'south',
108

    
109
    # first party
110
    'muparse',
111
    'accounts',
112
)
113

    
114
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
115

    
116
CACHE_BACKEND = ''
117
MUNIN_NODES = (
118
    (
119
        1, {
120
            'name': 'example1',
121
            'url': 'http://one.example.com',
122
            'cgi_path': 'cgi-bin/munin-cgi-graph/',
123
            'image_path': ''
124
        }
125
    ),
126
    (
127
        2, {
128
            'name': 'example2',
129
            'url': 'http://two.example.com',
130
            'cgi_path': 'cgi-bin/munin-cgi-graph/',
131
            'image_path': ''
132
        }
133
    ),
134
)
135

    
136
MUNIN_URL = "http://munin.example.com"
137
#MUNIN_URL = "http://munin.ping.uio.no"
138
MUNIN_CGI_PATH = "cgi-bin/munin-cgi-graph/"
139
#MUNIN_CGI_PATH = ""
140
MUNIN_IMAGE_PATH = ""
141
#CACHE_BACKEND = 'dummy://'
142

    
143
LDAP_AUTH_SETTINGS = (
144
    {
145
        'url': 'ldap://ldap.example.com/',
146
        'base': 'dc=dc,dc=example,dc=com'
147
    },
148
)
149
# If defined as a string new users will belong in this group. Group must exist
150
LDAP_AUTH_GROUP = None
151
# Whether new users will have admin access
152
LDAP_AUTH_IS_STAFF = False
153

    
154

    
155
def _dictmerge(a, b):
156
    """ deep merge two dictionaries """
157
    ret = dict(a.items() + b.items())
158
    for key in set(a.keys()) & set(b.keys()):
159
        if isinstance(a[key], dict) and isinstance(b[key], dict):
160
            ret[key] = _dictmerge(a[key], b[key])
161
    return ret
162

    
163
from local_settings import *  # noqa
164
for var, val in [i for i in locals().items() if i[0].startswith('EXTRA_')]:
165
    name = var[len('EXTRA_'):]
166
    try:
167
        locals()[name] += val  # append list
168
    except TypeError:
169
        locals()[name] = _dictmerge(locals()[name], val)  # merge dict