4 logger = logging.getLogger('myslice')
8 ROOT = os.path.realpath(os.path.dirname(__file__) + '/..')
11 logger.error(traceback.format_exc())
14 from myslice.configengine import ConfigEngine
16 config = ConfigEngine()
18 import myslice.components as components
23 # djcelery.setup_loader()
25 ### detect if we're in a build environment
35 if config.myslice.debug :
41 if config.myslice.theme :
42 theme = config.myslice.theme
47 if config.myslice.httproot :
48 HTTPROOT = config.myslice.httproot
53 if config.myslice.httproot :
54 DATAROOT = config.myslice.dataroot
59 # dec 2013 - we currently have 2 auxiliary subdirs with various utilities
60 # that we do not wish to package
61 # * sandbox is for plugin developers
62 # * sample is for various test views
63 # for each of these, if we find a directory of that name under ROOT, it then gets
64 # inserted in INSTALLED_APPS and its urls get included (see urls.py)
65 auxiliaries = [ 'sandbox', 'sample', ]
69 # ('your_name', 'your_email@test.com'),
75 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
76 #EMAIL_HOST_PASSWORD = "mypassword"
78 EMAIL_HOST = "localhost"
82 # use the email for debugging purpose
84 # python -m smtpd -n -c DebuggingServer localhost:1025
87 # EMAIL_HOST = 'localhost'
89 # EMAIL_HOST_USER = ''
90 # EMAIL_HOST_PASSWORD = ''
91 # EMAIL_USE_TLS = False
92 # DEFAULT_FROM_EMAIL = 'testing@example.com'
94 if config.database.engine :
97 'ENGINE' : 'django.db.backends.%s' % config.database.engine,
98 'USER' : config.database.user or '',
99 'PASSWORD' : config.database.password or '',
100 'HOST' : config.database.host or '',
101 'PORT' : config.database.port or '',
104 if config.database.engine == 'sqlite3' :
105 DATABASES['default']['NAME'] = os.path.join(DATAROOT,'%s.sqlite3' % config.database.name)
107 DATABASES['default']['NAME'] = config.database.name
109 # default database is sqlite
112 'ENGINE' : 'django.db.backends.sqlite3',
113 'NAME' : os.path.join(DATAROOT,'myslice.sqlite3'),
121 # Local time zone for this installation. Choices can be found here:
122 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
123 # although not all choices may be available on all operating systems.
124 # In a Windows environment this must be set to your system time zone.
125 TIME_ZONE = 'Europe/Paris'
127 # Language code for this installation. All choices can be found here:
128 # http://www.i18nguy.com/unicode/language-identifiers.html
129 LANGUAGE_CODE = 'en-us'
133 # If you set this to False, Django will make some optimizations so as not
134 # to load the internationalization machinery.
137 # If you set this to False, Django will not format dates, numbers and
138 # calendars according to the current locale.
141 # If you set this to False, Django will not use timezone-aware datetimes.
144 # Absolute filesystem path to the directory that will hold user-uploaded files.
145 # Example: "/home/media/media.lawrence.com/media/"
148 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
150 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
153 # Absolute path to the directory static files should be collected to.
154 # Don't put anything in this directory yourself; store your static files
155 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
156 # Example: "/home/media/media.lawrence.com/static/"
157 STATIC_ROOT = os.path.join(HTTPROOT,'static')
159 # URL prefix for static files.
160 # Example: "http://media.lawrence.com/static/"
161 STATIC_URL = '/static/'
163 # Additional locations of static files
165 # Put strings here, like "/home/html/static" or "C:/www/django/static".
166 # Always use forward slashes, even on Windows.
167 # Don't forget to use absolute paths, not relative paths.
168 # Thierry : we do not need to detail the contents
169 # of our 'apps' since they're mentioned in INSTALLED_APPS
172 # Needed by PluginFinder
173 PLUGIN_DIR = os.path.join(ROOT,'plugins')
175 THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
177 # List of finder classes that know how to find static files in
179 STATICFILES_FINDERS = (
180 # Thierry : no need for this one
181 # 'django.contrib.staticfiles.finders.FileSystemFinder',
182 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
183 'unfold.collectstatic.PluginFinder',
184 'unfold.collectstatic.ThirdPartyFinder',
185 ### 'django.contrib.staticfiles.finders.DefaultStorageFinder',
188 #TEMPLATE_CONTEXT_PROCESSORS = (
189 # 'django.contrib.auth.context_processors.auth',
190 # 'django.core.context_processors.debug',
191 # 'django.core.context_processors.i18n',
192 # 'django.core.context_processors.media',
193 # 'django.core.context_processors.static',
194 # 'django.core.context_processors.request',
195 # 'django.contrib.messages.context_processors.messages',
198 # Make this unique, and don't share it with anybody.
199 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
201 # List of callables that know how to import templates from various sources.
203 'django.template.loaders.filesystem.Loader',
204 'django.template.loaders.app_directories.Loader',
205 # 'django.template.loaders.eggs.Loader',
208 MIDDLEWARE_CLASSES = (
209 'django.middleware.common.CommonMiddleware',
210 'django.contrib.sessions.middleware.SessionMiddleware',
211 'django.middleware.csrf.CsrfViewMiddleware',
212 'django.contrib.auth.middleware.AuthenticationMiddleware',
213 'django.contrib.messages.middleware.MessageMiddleware',
214 # Uncomment the next line for simple clickjacking protection:
215 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
218 ROOT_URLCONF = 'myslice.urls'
220 # Python dotted path to the WSGI application used by Django's runserver.
221 WSGI_APPLICATION = 'unfold.wsgi.application'
224 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
225 # Always use forward slashes, even on Windows.
226 # Don't forget to use absolute paths, not relative paths.
227 if theme is not None:
228 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates", theme) )
229 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates") )
230 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"templates") )
233 'django.contrib.auth',
234 'django.contrib.contenttypes',
235 'django.contrib.sessions',
236 'django.contrib.sites',
237 'django.contrib.messages',
238 'django.contrib.staticfiles',
239 # handling the {% insert %} and {% container %} tags
240 # see details in devel/django-insert-above-1.0-4
250 # views - more or less stable
252 # Uncomment the next line to enable the admin:
253 'django.contrib.admin',
256 # Uncomment the next line to enable admin documentation:
257 # 'django.contrib.admindocs',
260 # with django-1.7 we leave south and use native migrations
261 # managing database migrations
263 major, minor, _, _, _ = django.VERSION
264 if major == 1 and minor <= 6:
265 INSTALLED_APPS.append('south')
267 # this app won't load in a build environment
269 INSTALLED_APPS.append ('rest')
271 for component in components.list() :
272 INSTALLED_APPS.append(component)
274 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
276 for aux in auxiliaries:
277 if os.path.isdir(os.path.join(ROOT,aux)):
278 logger.info("Using devel auxiliary {}".format(aux))
279 INSTALLED_APPS.append(aux)
281 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
283 # A sample logging configuration. The only tangible logging
284 # performed by this configuration is to send an email to
285 # the site admins on every HTTP 500 error when DEBUG=False.
286 # See http://docs.djangoproject.com/en/dev/topics/logging for
287 # more details on how to customize your logging configuration.
290 'disable_existing_loggers': False,
292 'require_debug_false': {
293 '()': 'django.utils.log.RequireDebugFalse'
299 'filters': ['require_debug_false'],
300 'class': 'django.utils.log.AdminEmailHandler',
305 'handlers': ['mail_admins'],
313 'disable_existing_loggers': True,
316 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
319 'format': '%(levelname)s %(message)s'
328 'class': 'django.utils.log.NullHandler',
332 'class': 'logging.StreamHandler',
333 'formatter': 'simple'
338 'handlers': ['debug'],
345 AUTHENTICATION_BACKENDS = ('localauth.manifoldbackend.ManifoldBackend',
346 'django.contrib.auth.backends.ModelBackend')
348 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
349 # without this setting django will return a 403 forbidden error, which is fine
350 # if you need to see the error message then use this setting
351 CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
353 #################### for insert_above
354 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
355 # put stuff under static/
356 # IA_MEDIA_PREFIX = '/code/'
360 SLA_MANAGER_URL = "http://157.193.215.125:4001/sla-collector/sla"
361 #SLA_MANAGER_URL = "http://172.24.76.28:8000/sla"
362 SLA_MANAGER_USER = "portal"
363 SLA_MANAGER_PASSWORD = "password"