source: mauRepo/MolesManager/trunk/cedaMoles/MolesManager/settings.py @ 8574

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/cedaMoles/MolesManager/settings.py@8574
Revision 8574, 7.8 KB checked in by mnagni, 7 years ago (diff)

Incomplete - # 22554: "Remove the ""FollowSymLinks"""
 http://team.ceda.ac.uk/trac/ceda/ticket/22554

Line 
1# Django settings for MolesManager project.
2import os
3
4
5def decodeRelativePath(relPath):
6    return os.path.join(os.path.dirname(__file__), relPath).replace('\\', '/')   
7   
8DJANGO_PROJECT = os.path.dirname(decodeRelativePath(''))
9SRC = os.path.dirname(DJANGO_PROJECT)
10PROJECT = os.path.dirname(SRC)
11
12
13DEBUG = True
14TEMPLATE_DEBUG = DEBUG
15
16ADMINS = (
17    # ('Your Name', 'your_email@example.com'),
18)
19
20SITE_ROOT = os.path.dirname(os.path.abspath(__file__))
21
22PROJECT_DIRNAME = SITE_ROOT.split(os.sep)[-1]
23
24
25MANAGERS = ADMINS
26
27DATABASES = {
28    'default': {
29        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
30        'NAME': '/sqlite.db',                      # Or path to database file if using sqlite3.
31        'USER': '',                      # Not used with sqlite3.
32        'PASSWORD': '',                  # Not used with sqlite3.
33        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
34        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
35    }
36}
37
38# Local time zone for this installation. Choices can be found here:
39# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
40# although not all choices may be available on all operating systems.
41# On Unix systems, a value of None will cause Django to use the same
42# timezone as the operating system.
43# If running in a Windows environment this must be set to the same as your
44# system time zone.
45TIME_ZONE = 'America/Chicago'
46
47# Language code for this installation. All choices can be found here:
48# http://www.i18nguy.com/unicode/language-identifiers.html
49LANGUAGE_CODE = 'en-gb'
50
51SITE_ID = 1
52
53# If you set this to False, Django will make some optimizations so as not
54# to load the internationalization machinery.
55USE_I18N = True
56
57# If you set this to False, Django will not format dates, numbers and
58# calendars according to the current locale
59USE_L10N = True
60
61# Absolute filesystem path to the directory that will hold user-uploaded files.
62# Example: "/home/media/media.lawrence.com/media/"
63MEDIA_ROOT = ''
64
65
66# URL that handles the media served from MEDIA_ROOT. Make sure to use a
67# trailing slash.
68# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
69MEDIA_URL = ''
70 
71# Absolute path to the directory static files should be collected to.
72# Don't put anything in this directory yourself; store your static files
73# in apps' "static/" subdirectories and in STATICFILES_DIRS.
74# Example: "/home/media/media.lawrence.com/static/"
75STATIC_ROOT = os.path.join(DJANGO_PROJECT, 'static')
76
77# URL prefix for static files.
78# Example: "http://media.lawrence.com/static/"
79
80#Deployment parameterized version
81#STATIC_URL = 'http://localhost'
82#STATIC_URL = 'http://127.0.0.1:8000/static/'
83#STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL)
84STATIC_URL = 'CUSTOM_STATIC_URL'
85#STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL)
86
87# URL prefix for admin static files -- CSS, JavaScript and images.
88# Make sure to use a trailing slash.
89# Examples: "http://foo.com/static/admin/", "/static/admin/".
90ADMIN_MEDIA_PREFIX = '/static/admin/'
91
92# Additional locations of static files
93STATICFILES_DIRS = (
94    ()
95    # Put strings here, like "/home/html/static" or "C:/www/django/static".
96    # Always use forward slashes, even on Windows.
97    # Don't forget to use absolute paths, not relative paths.
98)
99
100# List of finder classes that know how to find static files in
101# various locations.
102STATICFILES_FINDERS = (
103    'django.contrib.staticfiles.finders.FileSystemFinder',
104    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
105    'django.contrib.staticfiles.finders.DefaultStorageFinder',
106)
107
108
109
110
111# Make this unique, and don't share it with anybody.
112SECRET_KEY = '2ttix#hi63qnw0derz&0(60&65@v=@#5gg9$9r2jw5v)nccfg+'
113
114# List of callables that know how to import templates from various sources.
115TEMPLATE_LOADERS = (
116    'django.template.loaders.filesystem.Loader',
117    'django.template.loaders.app_directories.Loader',
118#     'django.template.loaders.eggs.Loader',
119)
120
121
122
123MIDDLEWARE_CLASSES = (
124    'django.middleware.common.CommonMiddleware',
125    'django.contrib.sessions.middleware.SessionMiddleware',
126    'django.middleware.csrf.CsrfViewMiddleware',
127    'django.contrib.auth.middleware.AuthenticationMiddleware',
128    'django.contrib.messages.middleware.MessageMiddleware',
129    'molesSessionMiddleware.MolesSessionMiddleware',
130)
131ROOT_URLCONF = 'MolesManager.urls'
132
133TEMPLATE_CONTEXT_PROCESSORS = (
134    "django.contrib.auth.context_processors.auth",
135    "django.core.context_processors.debug",
136    "django.core.context_processors.i18n",
137    "django.core.context_processors.media",
138    "django.core.context_processors.request",
139    "django.core.context_processors.static",
140)
141
142
143TEMPLATE_DIRS = (
144    decodeRelativePath('static/templates')                 
145    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
146    # Always use forward slashes, even on Windows.
147    # Don't forget to use absolute paths, not relative paths.
148)
149
150INSTALLED_APPS = (
151    'django.contrib.auth',
152    'django.contrib.contenttypes',
153    'django.contrib.sessions',
154    'django.contrib.sites',
155    'django.contrib.messages',
156    'django.contrib.staticfiles',
157    'ea_model',
158    # Uncomment the next line to enable the admin:
159    # 'django.contrib.admin',
160    # Uncomment the next line to enable admin documentation:
161    # 'django.contrib.admindocs',
162        #This line defines where catch the /static/ folder
163)
164
165SITE_ROOT = DJANGO_PROJECT
166
167# A sample logging configuration. The only tangible logging
168# performed by this configuration is to send an email to
169# the site admins on every HTTP 500 error.
170# See http://docs.djangoproject.com/en/dev/topics/logging for
171# more details on how to customize your logging configuration.
172LOGGING = {
173    'version': 1,
174    'disable_existing_loggers': True,
175    'formatters': {
176        'verbose': {
177            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
178        },
179        'simple': {
180            'format': '%(levelname)s %(message)s'
181        },
182    },   
183    'handlers': {
184        'mail_admins': {
185            'level': 'ERROR',
186            'class': 'django.utils.log.AdminEmailHandler'
187        },
188        'console':{
189            'level':'DEBUG',
190            'class':'logging.StreamHandler',
191            'formatter': 'verbose'
192        }
193    },
194    'loggers': {
195        'django.request': {
196            'handlers': ['mail_admins'],
197            'level': 'ERROR',
198            'propagate': True,
199        },
200        'sqlalchemy.engine': {
201            'handlers': ['console'],
202            'level': 'WARN',
203            'propagate': True,
204        }
205    }
206}
207
208#moles3 database connection
209#MOLES3_DB_CONNECTION = 'postgresql://user:pws@host:port/dbName'
210MOLES3_DB_CONNECTION = 'PG_MOLES3_DB_CONNECTION'
211from ea_model.sqlTables import doTables as doMoles, attachEvents
212MOLES3_DB_SCRIPT = doMoles
213EVENTS_DB = attachEvents
214
215
216#moles2 to moles3 migration database connection
217#MIGRATION_DB_CONNECTION = 'postgresql://user:pws@host:port/dbName'
218MIGRATION_DB_CONNECTION = 'PG_MIGRATION_DB_CONNECTION'
219from cedaMoles.libs.migration.db.migrationTables import doTables as doMigration
220MIGRATION_DB_SCRIPT = doMigration
221
222#INFO_DB_CONNECTION = 'postgresql://user:pws@host:port/dbName'
223INFO_DB_CONNECTION = 'PG_INFO_DB_CONNECTION'
224
225if os.environ.has_key('MIGRATION_DB_CONNECTION'):
226    MIGRATION_DB_CONNECTION = os.environ['MIGRATION_DB_CONNECTION']   
227   
228if os.environ.has_key('MOLES3_DB_CONNECTION'):
229    MOLES3_DB_CONNECTION = os.environ['MOLES3_DB_CONNECTION']
230   
231if os.environ.has_key('INFO_DB_CONNECTION'):
232    INFO_DB_CONNECTION = os.environ['INFO_DB_CONNECTION'] 
233
234RUN_MIGRATION = True
235#Default to one day
236MIGRATION_INTERVAL = 86400
237
238reportMigrationTo = ['maurizio.nagni@stfc.ac.uk', 'm.nagni@gmail.com']
239
240# Local modifications to settings are imported from settings_local.py
241from cedaMoles.MolesManager.settings_local import *
Note: See TracBrowser for help on using the repository browser.