6 logger = logging.getLogger('myslice')
10 ROOT = os.path.realpath(os.path.dirname(__file__) + '/..')
13 logger.error(traceback.format_exc())
16 from myslice.configengine import ConfigEngine
18 config = ConfigEngine()
20 import myslice.components as components
23 # djcelery.setup_loader()
25 ### detect if we're in a build environment
32 if not config.myslice.portal_version:
34 v = subprocess.check_output(["git", "--git-dir", ROOT + "/.git", "describe"])
35 PORTAL_VERSION = '-'.join(v.split('-')[:-1])
37 PORTAL_VERSION = 'not using git'
40 if config.myslice.debug :
42 INTERNAL_IPS = ("127.0.0.1","132.227.84.195","132.227.78.191","132.227.84.191")
47 if config.myslice.theme :
48 theme = config.myslice.theme
52 if config.myslice.theme_label :
53 theme_label = config.myslice.theme_label
57 if config.myslice.theme_logo :
58 theme_logo = config.myslice.theme_logo
60 theme_logo = theme + '.png'
63 if config.myslice.httproot :
64 HTTPROOT = config.myslice.httproot
69 if config.myslice.httproot :
70 DATAROOT = config.myslice.dataroot
75 # dec 2013 - we currently have 2 auxiliary subdirs with various utilities
76 # that we do not wish to package
77 # * sandbox is for plugin developers
78 # * sample is for various test views
79 # for each of these, if we find a directory of that name under ROOT, it then gets
80 # inserted in INSTALLED_APPS and its urls get included (see urls.py)
81 auxiliaries = [ 'sandbox', 'sample', ]
85 # ('your_name', 'your_email@test.com'),
91 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
92 #EMAIL_HOST_PASSWORD = "mypassword"
94 if config.myslice.default_sender:
95 DEFAULT_FROM_EMAIL = config.myslice.default_sender
97 EMAIL_HOST = "localhost"
101 # use the email for debugging purpose
103 # python -m smtpd -n -c DebuggingServer localhost:1025
106 # EMAIL_HOST = 'localhost'
108 # EMAIL_HOST_USER = ''
109 # EMAIL_HOST_PASSWORD = ''
110 # EMAIL_USE_TLS = False
111 # DEFAULT_FROM_EMAIL = 'testing@example.com'
113 if config.database.engine :
116 'ENGINE' : 'django.db.backends.%s' % config.database.engine,
117 'USER' : config.database.user or '',
118 'PASSWORD' : config.database.password or '',
119 'HOST' : config.database.host or '',
120 'PORT' : config.database.port or '',
123 if config.database.engine == 'sqlite3' :
124 DATABASES['default']['NAME'] = os.path.join(DATAROOT,'%s.sqlite3' % config.database.name)
126 DATABASES['default']['NAME'] = config.database.name
128 # default database is sqlite
131 'ENGINE' : 'django.db.backends.sqlite3',
132 'NAME' : os.path.join(DATAROOT,'myslice.sqlite3'),
140 # Local time zone for this installation. Choices can be found here:
141 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
142 # although not all choices may be available on all operating systems.
143 # In a Windows environment this must be set to your system time zone.
144 TIME_ZONE = 'Europe/Paris'
146 # Language code for this installation. All choices can be found here:
147 # http://www.i18nguy.com/unicode/language-identifiers.html
148 LANGUAGE_CODE = 'en-us'
152 # If you set this to False, Django will make some optimizations so as not
153 # to load the internationalization machinery.
156 # If you set this to False, Django will not format dates, numbers and
157 # calendars according to the current locale.
160 # If you set this to False, Django will not use timezone-aware datetimes.
163 # Absolute filesystem path to the directory that will hold user-uploaded files.
164 # Example: "/home/media/media.lawrence.com/media/"
167 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
169 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
172 # Absolute path to the directory static files should be collected to.
173 # Don't put anything in this directory yourself; store your static files
174 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
175 # Example: "/home/media/media.lawrence.com/static/"
176 STATIC_ROOT = os.path.join(HTTPROOT,'static')
178 # Additional locations of static files
180 # Put strings here, like "/home/html/static" or "C:/www/django/static".
181 # Always use forward slashes, even on Windows.
182 # Don't forget to use absolute paths, not relative paths.
183 # Thierry : we do not need to detail the contents
184 # of our 'apps' since they're mentioned in INSTALLED_APPS
187 # Needed by PluginFinder
188 PLUGIN_DIR = os.path.join(ROOT,'plugins')
190 THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
192 # List of finder classes that know how to find static files in
194 STATICFILES_FINDERS = (
195 # Thierry : no need for this one
196 # 'django.contrib.staticfiles.finders.FileSystemFinder',
197 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
198 'unfold.collectstatic.PluginFinder',
199 'unfold.collectstatic.ThirdPartyFinder',
200 ### 'django.contrib.staticfiles.finders.DefaultStorageFinder',
203 if config.myslice.secret_key:
204 # Make this unique, and don't share it with anybody.
205 SECRET_KEY = config.myslice.secret_key
207 raise Exception, "SECRET_KEY Not defined: Please setup a secret_key value in myslice.ini"
209 AUTHENTICATION_BACKENDS = ('localauth.manifoldbackend.ManifoldBackend',
210 'django.contrib.auth.backends.ModelBackend')
212 # List of callables that know how to import templates from various sources.
214 'django.template.loaders.filesystem.Loader',
215 'django.template.loaders.app_directories.Loader',
216 # 'django.template.loaders.eggs.Loader',
219 MIDDLEWARE_CLASSES = (
220 'django.middleware.common.CommonMiddleware',
221 'django.contrib.sessions.middleware.SessionMiddleware',
222 'django.middleware.csrf.CsrfViewMiddleware',
223 'django.contrib.auth.middleware.AuthenticationMiddleware',
224 'django.contrib.messages.middleware.MessageMiddleware',
225 # Uncomment the next line for simple clickjacking protection:
226 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
229 ROOT_URLCONF = 'myslice.urls'
231 # Python dotted path to the WSGI application used by Django's runserver.
232 WSGI_APPLICATION = 'unfold.wsgi.application'
235 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
236 # Always use forward slashes, even on Windows.
237 # Don't forget to use absolute paths, not relative paths.
238 if theme is not None:
239 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates", theme) )
240 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates") )
241 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"templates") )
244 'django.contrib.auth',
245 'django.contrib.contenttypes',
246 'django.contrib.sessions',
247 'django.contrib.sites',
248 'django.contrib.messages',
249 'django.contrib.staticfiles',
250 # handling the {% insert %} and {% container %} tags
251 # see details in devel/django-insert-above-1.0-4
261 # views - more or less stable
263 # Uncomment the next line to enable the admin:
264 'django.contrib.admin',
267 # Uncomment the next line to enable admin documentation:
268 # 'django.contrib.admindocs',
272 # with django-1.7 we leave south and use native migrations
273 # managing database migrations
275 major, minor, _, _, _ = django.VERSION
276 if major == 1 and minor <= 6:
277 INSTALLED_APPS.append('south')
279 # this app won't load in a build environment
281 INSTALLED_APPS.append ('rest')
283 for component in components.list() :
284 INSTALLED_APPS.append(component)
286 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
288 for aux in auxiliaries:
289 if os.path.isdir(os.path.join(ROOT,aux)):
290 logger.info("Using devel auxiliary {}".format(aux))
291 INSTALLED_APPS.append(aux)
293 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
295 # A sample logging configuration. The only tangible logging
296 # performed by this configuration is to send an email to
297 # the site admins on every HTTP 500 error when DEBUG=False.
298 # See http://docs.djangoproject.com/en/dev/topics/logging for
299 # more details on how to customize your logging configuration.
302 'disable_existing_loggers': False,
304 'require_debug_false': {
305 '()': 'django.utils.log.RequireDebugFalse'
311 'filters': ['require_debug_false'],
312 'class': 'django.utils.log.AdminEmailHandler',
317 'handlers': ['mail_admins'],
325 'disable_existing_loggers': True,
328 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
331 'format': '%(levelname)s %(message)s'
340 'class': 'django.utils.log.NullHandler',
344 'class': 'logging.StreamHandler',
345 'formatter': 'simple'
350 'handlers': ['debug'],
357 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
358 # without this setting django will return a 403 forbidden error, which is fine
359 # if you need to see the error message then use this setting
360 CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
362 #################### for insert_above
363 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
364 # put stuff under static/
365 # IA_MEDIA_PREFIX = '/code/'
369 SLA_COLLECTOR_URL = "https://157.193.215.125:4001/sla-collector/sla"
370 SLA_COLLECTOR_USER = "portal"
371 SLA_COLLECTOR_PASSWORD = "password"
374 # URL prefix for static files.
375 # Example: "http://media.lawrence.com/static/"
376 STATIC_URL = '/static/'