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 :
37 INTERNAL_IPS = ("127.0.0.1","132.227.84.195","132.227.78.191","132.227.84.191")
42 if config.myslice.theme :
43 theme = config.myslice.theme
48 if config.myslice.httproot :
49 HTTPROOT = config.myslice.httproot
54 if config.myslice.httproot :
55 DATAROOT = config.myslice.dataroot
60 # dec 2013 - we currently have 2 auxiliary subdirs with various utilities
61 # that we do not wish to package
62 # * sandbox is for plugin developers
63 # * sample is for various test views
64 # for each of these, if we find a directory of that name under ROOT, it then gets
65 # inserted in INSTALLED_APPS and its urls get included (see urls.py)
66 auxiliaries = [ 'sandbox', 'sample', ]
70 # ('your_name', 'your_email@test.com'),
76 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
77 #EMAIL_HOST_PASSWORD = "mypassword"
79 EMAIL_HOST = "localhost"
83 # use the email for debugging purpose
85 # python -m smtpd -n -c DebuggingServer localhost:1025
88 # EMAIL_HOST = 'localhost'
90 # EMAIL_HOST_USER = ''
91 # EMAIL_HOST_PASSWORD = ''
92 # EMAIL_USE_TLS = False
93 # DEFAULT_FROM_EMAIL = 'testing@example.com'
95 if config.database.engine :
98 'ENGINE' : 'django.db.backends.%s' % config.database.engine,
99 'USER' : config.database.user or '',
100 'PASSWORD' : config.database.password or '',
101 'HOST' : config.database.host or '',
102 'PORT' : config.database.port or '',
105 if config.database.engine == 'sqlite3' :
106 DATABASES['default']['NAME'] = os.path.join(DATAROOT,'%s.sqlite3' % config.database.name)
108 DATABASES['default']['NAME'] = config.database.name
110 # default database is sqlite
113 'ENGINE' : 'django.db.backends.sqlite3',
114 'NAME' : os.path.join(DATAROOT,'myslice.sqlite3'),
122 # Local time zone for this installation. Choices can be found here:
123 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
124 # although not all choices may be available on all operating systems.
125 # In a Windows environment this must be set to your system time zone.
126 TIME_ZONE = 'Europe/Paris'
128 # Language code for this installation. All choices can be found here:
129 # http://www.i18nguy.com/unicode/language-identifiers.html
130 LANGUAGE_CODE = 'en-us'
134 # If you set this to False, Django will make some optimizations so as not
135 # to load the internationalization machinery.
138 # If you set this to False, Django will not format dates, numbers and
139 # calendars according to the current locale.
142 # If you set this to False, Django will not use timezone-aware datetimes.
145 # Absolute filesystem path to the directory that will hold user-uploaded files.
146 # Example: "/home/media/media.lawrence.com/media/"
149 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
151 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
154 # Absolute path to the directory static files should be collected to.
155 # Don't put anything in this directory yourself; store your static files
156 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
157 # Example: "/home/media/media.lawrence.com/static/"
158 STATIC_ROOT = os.path.join(HTTPROOT,'static')
160 # URL prefix for static files.
161 # Example: "http://media.lawrence.com/static/"
162 STATIC_URL = '/static/'
164 # Additional locations of static files
166 # Put strings here, like "/home/html/static" or "C:/www/django/static".
167 # Always use forward slashes, even on Windows.
168 # Don't forget to use absolute paths, not relative paths.
169 # Thierry : we do not need to detail the contents
170 # of our 'apps' since they're mentioned in INSTALLED_APPS
173 # Needed by PluginFinder
174 PLUGIN_DIR = os.path.join(ROOT,'plugins')
176 THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
178 # List of finder classes that know how to find static files in
180 STATICFILES_FINDERS = (
181 # Thierry : no need for this one
182 # 'django.contrib.staticfiles.finders.FileSystemFinder',
183 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
184 'unfold.collectstatic.PluginFinder',
185 'unfold.collectstatic.ThirdPartyFinder',
186 ### 'django.contrib.staticfiles.finders.DefaultStorageFinder',
189 #TEMPLATE_CONTEXT_PROCESSORS = (
190 # 'django.contrib.auth.context_processors.auth',
191 # 'django.core.context_processors.debug',
192 # 'django.core.context_processors.i18n',
193 # 'django.core.context_processors.media',
194 # 'django.core.context_processors.static',
195 # 'django.core.context_processors.request',
196 # 'django.contrib.messages.context_processors.messages',
199 # Make this unique, and don't share it with anybody.
200 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
202 # List of callables that know how to import templates from various sources.
204 'django.template.loaders.filesystem.Loader',
205 'django.template.loaders.app_directories.Loader',
206 # 'django.template.loaders.eggs.Loader',
209 MIDDLEWARE_CLASSES = (
210 'django.middleware.common.CommonMiddleware',
211 'django.contrib.sessions.middleware.SessionMiddleware',
212 'django.middleware.csrf.CsrfViewMiddleware',
213 'django.contrib.auth.middleware.AuthenticationMiddleware',
214 'django.contrib.messages.middleware.MessageMiddleware',
215 # Uncomment the next line for simple clickjacking protection:
216 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
219 ROOT_URLCONF = 'myslice.urls'
221 # Python dotted path to the WSGI application used by Django's runserver.
222 WSGI_APPLICATION = 'unfold.wsgi.application'
225 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
226 # Always use forward slashes, even on Windows.
227 # Don't forget to use absolute paths, not relative paths.
228 if theme is not None:
229 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates", theme) )
230 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates") )
231 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"templates") )
234 'django.contrib.auth',
235 'django.contrib.contenttypes',
236 'django.contrib.sessions',
237 'django.contrib.sites',
238 'django.contrib.messages',
239 'django.contrib.staticfiles',
240 # handling the {% insert %} and {% container %} tags
241 # see details in devel/django-insert-above-1.0-4
251 # views - more or less stable
253 # Uncomment the next line to enable the admin:
254 'django.contrib.admin',
257 # Uncomment the next line to enable admin documentation:
258 # 'django.contrib.admindocs',
262 # with django-1.7 we leave south and use native migrations
263 # managing database migrations
265 major, minor, _, _, _ = django.VERSION
266 if major == 1 and minor <= 6:
267 INSTALLED_APPS.append('south')
269 # this app won't load in a build environment
271 INSTALLED_APPS.append ('rest')
273 for component in components.list() :
274 INSTALLED_APPS.append(component)
276 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
278 for aux in auxiliaries:
279 if os.path.isdir(os.path.join(ROOT,aux)):
280 logger.info("Using devel auxiliary {}".format(aux))
281 INSTALLED_APPS.append(aux)
283 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
285 # A sample logging configuration. The only tangible logging
286 # performed by this configuration is to send an email to
287 # the site admins on every HTTP 500 error when DEBUG=False.
288 # See http://docs.djangoproject.com/en/dev/topics/logging for
289 # more details on how to customize your logging configuration.
292 'disable_existing_loggers': False,
294 'require_debug_false': {
295 '()': 'django.utils.log.RequireDebugFalse'
301 'filters': ['require_debug_false'],
302 'class': 'django.utils.log.AdminEmailHandler',
307 'handlers': ['mail_admins'],
315 'disable_existing_loggers': True,
318 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
321 'format': '%(levelname)s %(message)s'
330 'class': 'django.utils.log.NullHandler',
334 'class': 'logging.StreamHandler',
335 'formatter': 'simple'
340 'handlers': ['debug'],
347 AUTHENTICATION_BACKENDS = ('localauth.manifoldbackend.ManifoldBackend',
348 'django.contrib.auth.backends.ModelBackend')
350 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
351 # without this setting django will return a 403 forbidden error, which is fine
352 # if you need to see the error message then use this setting
353 CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
355 #################### for insert_above
356 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
357 # put stuff under static/
358 # IA_MEDIA_PREFIX = '/code/'
362 SLA_COLLECTOR_URL = "http://157.193.215.125:4001/sla-collector/sla"
363 SLA_COLLECTOR_USER = "portal"
364 SLA_COLLECTOR_PASSWORD = "password"