1 from __future__ import print_function
3 import myslice.components
4 from myslice.configengine import ConfigEngine
9 # djcelery.setup_loader()
11 ### detect if we're in a build environment
18 config = ConfigEngine()
20 if config.myslice.debug :
25 # show the various settings as we go
26 DEBUG_SETTINGS = False
28 # but you can redefine ROOT if that's not working for you
30 # get the directory where this file is
31 ROOT = os.path.realpath(os.path.dirname(__file__) + '/..')
33 # something is badly wrong here
38 #### this is where the problem lies I believe
39 # first try to run manage.py collectstatic without this
41 if config.myslice.theme :
42 theme = config.myslice.theme
47 if config.myslice.httproot :
48 HTTPROOT = config.myslice.httproot
50 HTTPROOT = "/var/myslice-f4f"
53 if config.myslice.httproot :
54 DATAROOT = config.myslice.httproot
56 DATAROOT = "/var/unfold"
58 if not os.path.isdir(DATAROOT):
59 print("WARNING: {} is a non-existing directory".format(DATAROOT))
60 print("consequently we assume development mode and re-route DATAROOT to {}".format(ROOT))
63 # if not there, then we assume it's from a devel tree
64 if not os.path.isdir (os.path.join(HTTPROOT,"static")):
67 if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for unfold"%ROOT
68 if not os.path.isdir(HTTPROOT): raise Exception,"Cannot find HTTPROOT %s for unfold"%HTTPROOT
72 print('DATAROOT', DATAROOT)
73 print('HTTPROOT', HTTPROOT)
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 EMAIL_HOST = "localhost"
98 # use the email for debugging purpose
100 # python -m smtpd -n -c DebuggingServer localhost:1025
103 # EMAIL_HOST = 'localhost'
105 # EMAIL_HOST_USER = ''
106 # EMAIL_HOST_PASSWORD = ''
107 # EMAIL_USE_TLS = False
108 # DEFAULT_FROM_EMAIL = 'testing@example.com'
112 'ENGINE' : 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
113 'NAME' : os.path.join(DATAROOT,'unfold.sqlite3'), # Or path to database file if using sqlite3.
114 'USER' : '', # Not used with sqlite3.
115 'PASSWORD' : '', # Not used with sqlite3.
116 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
117 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
122 print('DATABASE NAME',DATABASES['default']['NAME'])
124 # Local time zone for this installation. Choices can be found here:
125 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
126 # although not all choices may be available on all operating systems.
127 # In a Windows environment this must be set to your system time zone.
128 TIME_ZONE = 'Europe/Paris'
130 # Language code for this installation. All choices can be found here:
131 # http://www.i18nguy.com/unicode/language-identifiers.html
132 LANGUAGE_CODE = 'en-us'
136 # If you set this to False, Django will make some optimizations so as not
137 # to load the internationalization machinery.
140 # If you set this to False, Django will not format dates, numbers and
141 # calendars according to the current locale.
144 # If you set this to False, Django will not use timezone-aware datetimes.
147 # Absolute filesystem path to the directory that will hold user-uploaded files.
148 # Example: "/home/media/media.lawrence.com/media/"
151 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
153 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
156 # Absolute path to the directory static files should be collected to.
157 # Don't put anything in this directory yourself; store your static files
158 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
159 # Example: "/home/media/media.lawrence.com/static/"
160 STATIC_ROOT = os.path.join(HTTPROOT,'static')
162 # URL prefix for static files.
163 # Example: "http://media.lawrence.com/static/"
164 STATIC_URL = '/static/'
166 # Additional locations of static files
168 # Put strings here, like "/home/html/static" or "C:/www/django/static".
169 # Always use forward slashes, even on Windows.
170 # Don't forget to use absolute paths, not relative paths.
171 # Thierry : we do not need to detail the contents
172 # of our 'apps' since they're mentioned in INSTALLED_APPS
175 # Needed by PluginFinder
176 PLUGIN_DIR = os.path.join(ROOT,'plugins')
178 THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
180 # List of finder classes that know how to find static files in
182 STATICFILES_FINDERS = (
183 # Thierry : no need for this one
184 # 'django.contrib.staticfiles.finders.FileSystemFinder',
185 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
186 'unfold.collectstatic.PluginFinder',
187 'unfold.collectstatic.ThirdPartyFinder',
188 ### 'django.contrib.staticfiles.finders.DefaultStorageFinder',
191 #TEMPLATE_CONTEXT_PROCESSORS = (
192 # 'django.contrib.auth.context_processors.auth',
193 # 'django.core.context_processors.debug',
194 # 'django.core.context_processors.i18n',
195 # 'django.core.context_processors.media',
196 # 'django.core.context_processors.static',
197 # 'django.core.context_processors.request',
198 # 'django.contrib.messages.context_processors.messages',
201 # Make this unique, and don't share it with anybody.
202 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
204 # List of callables that know how to import templates from various sources.
206 'django.template.loaders.filesystem.Loader',
207 'django.template.loaders.app_directories.Loader',
208 # 'django.template.loaders.eggs.Loader',
211 MIDDLEWARE_CLASSES = (
212 'django.middleware.common.CommonMiddleware',
213 'django.contrib.sessions.middleware.SessionMiddleware',
214 'django.middleware.csrf.CsrfViewMiddleware',
215 'django.contrib.auth.middleware.AuthenticationMiddleware',
216 'django.contrib.messages.middleware.MessageMiddleware',
217 # Uncomment the next line for simple clickjacking protection:
218 # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
221 ROOT_URLCONF = 'myslice.urls'
223 # Python dotted path to the WSGI application used by Django's runserver.
224 WSGI_APPLICATION = 'unfold.wsgi.application'
227 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
228 # Always use forward slashes, even on Windows.
229 # Don't forget to use absolute paths, not relative paths.
230 if theme is not None:
231 TEMPLATE_DIRS.append ( os.path.join(HTTPROOT,"portal/templates", theme))
232 TEMPLATE_DIRS.append ( os.path.join(HTTPROOT,"portal/templates"))
233 TEMPLATE_DIRS.append ( os.path.join(HTTPROOT,"templates"))
236 'django.contrib.auth',
237 'django.contrib.contenttypes',
238 'django.contrib.sessions',
239 'django.contrib.sites',
240 'django.contrib.messages',
241 'django.contrib.staticfiles',
242 # handling the {% insert %} and {% container %} tags
243 # see details in devel/django-insert-above-1.0-4
253 # views - more or less stable
255 # managing database migrations
257 # Uncomment the next line to enable the admin:
258 'django.contrib.admin',
261 # Uncomment the next line to enable admin documentation:
262 # 'django.contrib.admindocs',
265 # this app won't load in a build environment
266 if not building: INSTALLED_APPS.append ('rest')
268 for component in components.list() :
269 INSTALLED_APPS.append(component)
271 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
273 for aux in auxiliaries:
274 if os.path.isdir(os.path.join(ROOT,aux)):
275 print("Using devel auxiliary",aux)
276 INSTALLED_APPS.append(aux)
278 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
280 # A sample logging configuration. The only tangible logging
281 # performed by this configuration is to send an email to
282 # the site admins on every HTTP 500 error when DEBUG=False.
283 # See http://docs.djangoproject.com/en/dev/topics/logging for
284 # more details on how to customize your logging configuration.
287 'disable_existing_loggers': False,
289 'require_debug_false': {
290 '()': 'django.utils.log.RequireDebugFalse'
296 'filters': ['require_debug_false'],
297 'class': 'django.utils.log.AdminEmailHandler',
302 'handlers': ['mail_admins'],
309 AUTHENTICATION_BACKENDS = ('auth.manifoldbackend.ManifoldBackend',
310 'django.contrib.auth.backends.ModelBackend')
312 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
313 # without this setting django will return a 403 forbidden error, which is fine
314 # if you need to see the error message then use this setting
315 CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
317 #################### for insert_above
318 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
319 # put stuff under static/
320 # IA_MEDIA_PREFIX = '/code/'
324 SLA_MANAGER_URL = "http://157.193.215.125:4001/sla-collector/sla"
325 #SLA_MANAGER_URL = "http://172.24.76.28:8000/sla"
326 SLA_MANAGER_USER = "portal"
327 SLA_MANAGER_PASSWORD = "password"