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 PORTAL_VERSION = subprocess.check_output(["git", "describe"])
36 PORTAL_VERSION = 'not using git'
39 if config.myslice.debug :
41 INTERNAL_IPS = ("127.0.0.1","132.227.84.195","132.227.78.191","132.227.84.191")
46 if config.myslice.theme :
47 theme = config.myslice.theme
51 if config.myslice.theme_label :
52 theme_label = config.myslice.theme_label
56 if config.myslice.theme_logo :
57 theme_logo = config.myslice.theme_logo
59 theme_logo = theme + '.png'
62 if config.myslice.httproot :
63 HTTPROOT = config.myslice.httproot
68 if config.myslice.httproot :
69 DATAROOT = config.myslice.dataroot
74 # dec 2013 - we currently have 2 auxiliary subdirs with various utilities
75 # that we do not wish to package
76 # * sandbox is for plugin developers
77 # * sample is for various test views
78 # for each of these, if we find a directory of that name under ROOT, it then gets
79 # inserted in INSTALLED_APPS and its urls get included (see urls.py)
80 auxiliaries = [ 'sandbox', 'sample', ]
84 # ('your_name', 'your_email@test.com'),
90 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
91 #EMAIL_HOST_PASSWORD = "mypassword"
93 EMAIL_HOST = "localhost"
97 # use the email for debugging purpose
99 # python -m smtpd -n -c DebuggingServer localhost:1025
102 # EMAIL_HOST = 'localhost'
104 # EMAIL_HOST_USER = ''
105 # EMAIL_HOST_PASSWORD = ''
106 # EMAIL_USE_TLS = False
107 # DEFAULT_FROM_EMAIL = 'testing@example.com'
109 if config.database.engine :
112 'ENGINE' : 'django.db.backends.%s' % config.database.engine,
113 'USER' : config.database.user or '',
114 'PASSWORD' : config.database.password or '',
115 'HOST' : config.database.host or '',
116 'PORT' : config.database.port or '',
119 if config.database.engine == 'sqlite3' :
120 DATABASES['default']['NAME'] = os.path.join(DATAROOT,'%s.sqlite3' % config.database.name)
122 DATABASES['default']['NAME'] = config.database.name
124 # default database is sqlite
127 'ENGINE' : 'django.db.backends.sqlite3',
128 'NAME' : os.path.join(DATAROOT,'myslice.sqlite3'),
136 # Local time zone for this installation. Choices can be found here:
137 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
138 # although not all choices may be available on all operating systems.
139 # In a Windows environment this must be set to your system time zone.
140 TIME_ZONE = 'Europe/Paris'
142 # Language code for this installation. All choices can be found here:
143 # http://www.i18nguy.com/unicode/language-identifiers.html
144 LANGUAGE_CODE = 'en-us'
148 # If you set this to False, Django will make some optimizations so as not
149 # to load the internationalization machinery.
152 # If you set this to False, Django will not format dates, numbers and
153 # calendars according to the current locale.
156 # If you set this to False, Django will not use timezone-aware datetimes.
159 # Absolute filesystem path to the directory that will hold user-uploaded files.
160 # Example: "/home/media/media.lawrence.com/media/"
163 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
165 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
168 # Absolute path to the directory static files should be collected to.
169 # Don't put anything in this directory yourself; store your static files
170 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
171 # Example: "/home/media/media.lawrence.com/static/"
172 STATIC_ROOT = os.path.join(HTTPROOT,'static')
174 # Additional locations of static files
176 # Put strings here, like "/home/html/static" or "C:/www/django/static".
177 # Always use forward slashes, even on Windows.
178 # Don't forget to use absolute paths, not relative paths.
179 # Thierry : we do not need to detail the contents
180 # of our 'apps' since they're mentioned in INSTALLED_APPS
183 # Needed by PluginFinder
184 PLUGIN_DIR = os.path.join(ROOT,'plugins')
186 THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
188 # List of finder classes that know how to find static files in
190 STATICFILES_FINDERS = (
191 # Thierry : no need for this one
192 # 'django.contrib.staticfiles.finders.FileSystemFinder',
193 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
194 'unfold.collectstatic.PluginFinder',
195 'unfold.collectstatic.ThirdPartyFinder',
196 ### 'django.contrib.staticfiles.finders.DefaultStorageFinder',
199 if config.myslice.secret_key:
200 # Make this unique, and don't share it with anybody.
201 SECRET_KEY = config.myslice.secret_key
203 raise Exception, "SECRET_KEY Not defined: Please setup a secret_key value in myslice.ini"
205 AUTHENTICATION_BACKENDS = ('localauth.manifoldbackend.ManifoldBackend',
206 'django.contrib.auth.backends.ModelBackend')
208 # List of callables that know how to import templates from various sources.
210 'django.template.loaders.filesystem.Loader',
211 'django.template.loaders.app_directories.Loader',
212 # 'django.template.loaders.eggs.Loader',
215 MIDDLEWARE_CLASSES = (
216 'django.middleware.common.CommonMiddleware',
217 'django.contrib.sessions.middleware.SessionMiddleware',
218 'django.middleware.csrf.CsrfViewMiddleware',
219 'django.contrib.auth.middleware.AuthenticationMiddleware',
220 'django.contrib.messages.middleware.MessageMiddleware',
221 # Uncomment the next line for simple clickjacking protection:
222 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
225 ROOT_URLCONF = 'myslice.urls'
227 # Python dotted path to the WSGI application used by Django's runserver.
228 WSGI_APPLICATION = 'unfold.wsgi.application'
231 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
232 # Always use forward slashes, even on Windows.
233 # Don't forget to use absolute paths, not relative paths.
234 if theme is not None:
235 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates", theme) )
236 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"portal/templates") )
237 TEMPLATE_DIRS.append( os.path.join(HTTPROOT,"templates") )
240 'django.contrib.auth',
241 'django.contrib.contenttypes',
242 'django.contrib.sessions',
243 'django.contrib.sites',
244 'django.contrib.messages',
245 'django.contrib.staticfiles',
246 # handling the {% insert %} and {% container %} tags
247 # see details in devel/django-insert-above-1.0-4
257 # views - more or less stable
259 # Uncomment the next line to enable the admin:
260 'django.contrib.admin',
263 # Uncomment the next line to enable admin documentation:
264 # 'django.contrib.admindocs',
268 # with django-1.7 we leave south and use native migrations
269 # managing database migrations
271 major, minor, _, _, _ = django.VERSION
272 if major == 1 and minor <= 6:
273 INSTALLED_APPS.append('south')
275 # this app won't load in a build environment
277 INSTALLED_APPS.append ('rest')
279 for component in components.list() :
280 INSTALLED_APPS.append(component)
282 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
284 for aux in auxiliaries:
285 if os.path.isdir(os.path.join(ROOT,aux)):
286 logger.info("Using devel auxiliary {}".format(aux))
287 INSTALLED_APPS.append(aux)
289 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
291 # A sample logging configuration. The only tangible logging
292 # performed by this configuration is to send an email to
293 # the site admins on every HTTP 500 error when DEBUG=False.
294 # See http://docs.djangoproject.com/en/dev/topics/logging for
295 # more details on how to customize your logging configuration.
298 'disable_existing_loggers': False,
300 'require_debug_false': {
301 '()': 'django.utils.log.RequireDebugFalse'
307 'filters': ['require_debug_false'],
308 'class': 'django.utils.log.AdminEmailHandler',
313 'handlers': ['mail_admins'],
321 'disable_existing_loggers': True,
324 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
327 'format': '%(levelname)s %(message)s'
336 'class': 'django.utils.log.NullHandler',
340 'class': 'logging.StreamHandler',
341 'formatter': 'simple'
346 'handlers': ['debug'],
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"
370 # URL prefix for static files.
371 # Example: "http://media.lawrence.com/static/"
372 STATIC_URL = '/static/'