5 logger = logging.getLogger('myslice')
9 ROOT = os.path.realpath(os.path.dirname(__file__) + '/..')
12 logger.error(traceback.format_exc())
15 from myslice.configengine import ConfigEngine
17 config = ConfigEngine()
19 import myslice.components as components
22 # djcelery.setup_loader()
24 ### detect if we're in a build environment
31 if not config.myslice.portal_version:
33 PORTAL_VERSION = subprocess.check_output(["git", "describe"])
35 PORTAL_VERSION = 'not using git'
38 if config.myslice.debug :
40 INTERNAL_IPS = ("127.0.0.1","132.227.84.195","132.227.78.191","132.227.84.191")
45 if config.myslice.theme :
46 theme = config.myslice.theme
51 if config.myslice.httproot :
52 HTTPROOT = config.myslice.httproot
57 if config.myslice.httproot :
58 DATAROOT = config.myslice.dataroot
63 # dec 2013 - we currently have 2 auxiliary subdirs with various utilities
64 # that we do not wish to package
65 # * sandbox is for plugin developers
66 # * sample is for various test views
67 # for each of these, if we find a directory of that name under ROOT, it then gets
68 # inserted in INSTALLED_APPS and its urls get included (see urls.py)
69 auxiliaries = [ 'sandbox', 'sample', ]
73 # ('your_name', 'your_email@test.com'),
79 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
80 #EMAIL_HOST_PASSWORD = "mypassword"
82 EMAIL_HOST = "localhost"
86 # use the email for debugging purpose
88 # python -m smtpd -n -c DebuggingServer localhost:1025
91 # EMAIL_HOST = 'localhost'
93 # EMAIL_HOST_USER = ''
94 # EMAIL_HOST_PASSWORD = ''
95 # EMAIL_USE_TLS = False
96 # DEFAULT_FROM_EMAIL = 'testing@example.com'
98 if config.database.engine :
101 'ENGINE' : 'django.db.backends.%s' % config.database.engine,
102 'USER' : config.database.user or '',
103 'PASSWORD' : config.database.password or '',
104 'HOST' : config.database.host or '',
105 'PORT' : config.database.port or '',
108 if config.database.engine == 'sqlite3' :
109 DATABASES['default']['NAME'] = os.path.join(DATAROOT,'%s.sqlite3' % config.database.name)
111 DATABASES['default']['NAME'] = config.database.name
113 # default database is sqlite
116 'ENGINE' : 'django.db.backends.sqlite3',
117 'NAME' : os.path.join(DATAROOT,'myslice.sqlite3'),
125 # Local time zone for this installation. Choices can be found here:
126 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
127 # although not all choices may be available on all operating systems.
128 # In a Windows environment this must be set to your system time zone.
129 TIME_ZONE = 'Europe/Paris'
131 # Language code for this installation. All choices can be found here:
132 # http://www.i18nguy.com/unicode/language-identifiers.html
133 LANGUAGE_CODE = 'en-us'
137 # If you set this to False, Django will make some optimizations so as not
138 # to load the internationalization machinery.
141 # If you set this to False, Django will not format dates, numbers and
142 # calendars according to the current locale.
145 # If you set this to False, Django will not use timezone-aware datetimes.
148 # Absolute filesystem path to the directory that will hold user-uploaded files.
149 # Example: "/home/media/media.lawrence.com/media/"
152 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
154 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
157 # Absolute path to the directory static files should be collected to.
158 # Don't put anything in this directory yourself; store your static files
159 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
160 # Example: "/home/media/media.lawrence.com/static/"
161 STATIC_ROOT = os.path.join(HTTPROOT,'static')
163 # URL prefix for static files.
164 # Example: "http://media.lawrence.com/static/"
165 STATIC_URL = '/static/'
167 # Additional locations of static files
169 # Put strings here, like "/home/html/static" or "C:/www/django/static".
170 # Always use forward slashes, even on Windows.
171 # Don't forget to use absolute paths, not relative paths.
172 # Thierry : we do not need to detail the contents
173 # of our 'apps' since they're mentioned in INSTALLED_APPS
176 # Needed by PluginFinder
177 PLUGIN_DIR = os.path.join(ROOT,'plugins')
179 THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
181 # List of finder classes that know how to find static files in
183 STATICFILES_FINDERS = (
184 # Thierry : no need for this one
185 # 'django.contrib.staticfiles.finders.FileSystemFinder',
186 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
187 'unfold.collectstatic.PluginFinder',
188 'unfold.collectstatic.ThirdPartyFinder',
189 ### 'django.contrib.staticfiles.finders.DefaultStorageFinder',
192 #TEMPLATE_CONTEXT_PROCESSORS = (
193 # 'django.contrib.auth.context_processors.auth',
194 # 'django.core.context_processors.debug',
195 # 'django.core.context_processors.i18n',
196 # 'django.core.context_processors.media',
197 # 'django.core.context_processors.static',
198 # 'django.core.context_processors.request',
199 # 'django.contrib.messages.context_processors.messages',
202 # Make this unique, and don't share it with anybody.
203 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
205 # List of callables that know how to import templates from various sources.
207 'django.template.loaders.filesystem.Loader',
208 'django.template.loaders.app_directories.Loader',
209 # 'django.template.loaders.eggs.Loader',
212 MIDDLEWARE_CLASSES = (
213 'django.middleware.common.CommonMiddleware',
214 'django.contrib.sessions.middleware.SessionMiddleware',
215 'django.middleware.csrf.CsrfViewMiddleware',
216 'django.contrib.auth.middleware.AuthenticationMiddleware',
217 'django.contrib.messages.middleware.MessageMiddleware',
218 # Uncomment the next line for simple clickjacking protection:
219 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
222 ROOT_URLCONF = 'myslice.urls'
224 # Python dotted path to the WSGI application used by Django's runserver.
225 WSGI_APPLICATION = 'unfold.wsgi.application'
228 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
229 # Always use forward slashes, even on Windows.
230 # Don't forget to use absolute paths, not relative paths.
231 if theme is not None:
232 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates", theme) )
233 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates") )
234 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"templates") )
237 'django.contrib.auth',
238 'django.contrib.contenttypes',
239 'django.contrib.sessions',
240 'django.contrib.sites',
241 'django.contrib.messages',
242 'django.contrib.staticfiles',
243 # handling the {% insert %} and {% container %} tags
244 # see details in devel/django-insert-above-1.0-4
254 # views - more or less stable
256 # Uncomment the next line to enable the admin:
257 'django.contrib.admin',
260 # Uncomment the next line to enable admin documentation:
261 # 'django.contrib.admindocs',
265 # with django-1.7 we leave south and use native migrations
266 # managing database migrations
268 major, minor, _, _, _ = django.VERSION
269 if major == 1 and minor <= 6:
270 INSTALLED_APPS.append('south')
272 # this app won't load in a build environment
274 INSTALLED_APPS.append ('rest')
276 for component in components.list() :
277 INSTALLED_APPS.append(component)
279 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
281 for aux in auxiliaries:
282 if os.path.isdir(os.path.join(ROOT,aux)):
283 logger.info("Using devel auxiliary {}".format(aux))
284 INSTALLED_APPS.append(aux)
286 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
288 # A sample logging configuration. The only tangible logging
289 # performed by this configuration is to send an email to
290 # the site admins on every HTTP 500 error when DEBUG=False.
291 # See http://docs.djangoproject.com/en/dev/topics/logging for
292 # more details on how to customize your logging configuration.
295 'disable_existing_loggers': False,
297 'require_debug_false': {
298 '()': 'django.utils.log.RequireDebugFalse'
304 'filters': ['require_debug_false'],
305 'class': 'django.utils.log.AdminEmailHandler',
310 'handlers': ['mail_admins'],
318 'disable_existing_loggers': True,
321 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
324 'format': '%(levelname)s %(message)s'
333 'class': 'django.utils.log.NullHandler',
337 'class': 'logging.StreamHandler',
338 'formatter': 'simple'
343 'handlers': ['debug'],
350 AUTHENTICATION_BACKENDS = ('localauth.manifoldbackend.ManifoldBackend',
351 'django.contrib.auth.backends.ModelBackend')
353 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
354 # without this setting django will return a 403 forbidden error, which is fine
355 # if you need to see the error message then use this setting
356 CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
358 #################### for insert_above
359 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
360 # put stuff under static/
361 # IA_MEDIA_PREFIX = '/code/'
365 SLA_COLLECTOR_URL = "http://157.193.215.125:4001/sla-collector/sla"
366 SLA_COLLECTOR_USER = "portal"
367 SLA_COLLECTOR_PASSWORD = "password"