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

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

Complete - # 22551: List resources / display single file
 http://team.ceda.ac.uk/trac/ceda/ticket/22551

Starts to update #22554. Works correctly on a localhost base

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