1 # Django settings for unfold project.
3 from __future__ import print_function
8 # djcelery.setup_loader()
10 ### detect if we're in a build environment
19 # show the various settings as we go
20 DEBUG_SETTINGS = False
22 # compute ROOT from where this file is installed
23 # should fit every need including developers
24 # but you can redefine ROOT if that's not working for you
26 # get the directory where this file is
27 ROOT=os.path.dirname(__file__) or '.'
29 ROOT=os.path.realpath(ROOT+'/..')
31 # something is badly wrong here
36 #### this is where the problem lies I believe
37 # first try to run manage.py collectstatic without this
41 from myslice.configengine import ConfigEngine
42 configEngine = ConfigEngine()
43 if configEngine.myslice.theme :
44 theme = configEngine.myslice.theme
53 # find out HTTPROOT, which is different from ROOT
54 # when deployed from a package
55 # this code is run by collectstatic too, so we cannot
56 # assume we have ./static present already
57 HTTPROOT="/var/myslice-f4f"
58 # the place to store local data, like e.g. the sqlite db
59 DATAROOT="/var/unfold"
60 if not os.path.isdir(DATAROOT):
61 print("WARNING: {} is a non-existing directory".format(DATAROOT))
62 print("consequently we assume development mode and re-route DATAROOT to {}".format(ROOT))
64 # if not there, then we assume it's from a devel tree
65 if not os.path.isdir (os.path.join(HTTPROOT,"static")):
68 if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for unfold"%ROOT
69 if not os.path.isdir(HTTPROOT): raise Exception,"Cannot find HTTPROOT %s for unfold"%HTTPROOT
73 print('DATAROOT', DATAROOT)
74 print('HTTPROOT', HTTPROOT)
76 # dec 2013 - we currently have 2 auxiliary subdirs with various utilities
77 # that we do not wish to package
78 # * sandbox is for plugin developers
79 # * sample is for various test views
80 # for each of these, if we find a directory of that name under ROOT, it then gets
81 # inserted in INSTALLED_APPS and its urls get included (see urls.py)
82 auxiliaries = [ 'sandbox', 'sample', ]
86 # ('your_name', 'your_email@test.com'),
92 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
93 #EMAIL_HOST_PASSWORD = "mypassword"
95 EMAIL_HOST = "localhost"
99 # use the email for debugging purpose
101 # python -m smtpd -n -c DebuggingServer localhost:1025
104 # EMAIL_HOST = 'localhost'
106 # EMAIL_HOST_USER = ''
107 # EMAIL_HOST_PASSWORD = ''
108 # EMAIL_USE_TLS = False
109 # DEFAULT_FROM_EMAIL = 'testing@example.com'
113 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
114 'NAME': os.path.join(DATAROOT,'unfold.sqlite3'), # Or path to database file if using sqlite3.
115 'USER': '', # Not used with sqlite3.
116 'PASSWORD': '', # Not used with sqlite3.
117 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
118 'PORT': '', # Set to empty string for default. Not used with sqlite3.
123 print('DATABASE NAME',DATABASES['default']['NAME'])
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 # managing database migrations
258 # Uncomment the next line to enable the admin:
259 'django.contrib.admin',
262 # Uncomment the next line to enable admin documentation:
263 # 'django.contrib.admindocs',
266 # this app won't load in a build environment
267 if not building: INSTALLED_APPS.append ('rest')
269 for component in components.list() :
270 INSTALLED_APPS.append(component)
272 BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
274 for aux in auxiliaries:
275 if os.path.isdir(os.path.join(ROOT,aux)):
276 print("Using devel auxiliary",aux)
277 INSTALLED_APPS.append(aux)
279 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
281 # A sample logging configuration. The only tangible logging
282 # performed by this configuration is to send an email to
283 # the site admins on every HTTP 500 error when DEBUG=False.
284 # See http://docs.djangoproject.com/en/dev/topics/logging for
285 # more details on how to customize your logging configuration.
288 'disable_existing_loggers': False,
290 'require_debug_false': {
291 '()': 'django.utils.log.RequireDebugFalse'
297 'filters': ['require_debug_false'],
298 'class': 'django.utils.log.AdminEmailHandler',
303 'handlers': ['mail_admins'],
310 AUTHENTICATION_BACKENDS = ('auth.manifoldbackend.ManifoldBackend',
311 'django.contrib.auth.backends.ModelBackend')
313 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
314 # without this setting django will return a 403 forbidden error, which is fine
315 # if you need to see the error message then use this setting
316 CSRF_FAILURE_VIEW = 'manifoldapi.manifoldproxy.csrf_failure'
318 #################### for insert_above
319 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
320 # put stuff under static/
321 # IA_MEDIA_PREFIX = '/code/'
325 SLA_MANAGER_URL = "http://157.193.215.125:4001/sla-collector/sla"
326 #SLA_MANAGER_URL = "http://172.24.76.28:8000/sla"
327 SLA_MANAGER_USER = "portal"
328 SLA_MANAGER_PASSWORD = "password"