source: mauRepo/MolesManager/trunk/src/MolesManager/settings.py @ 8137

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/MolesManager/settings.py@8137
Revision 8137, 6.5 KB checked in by mnagni, 8 years ago (diff)

Updated the urls.py in order to allow a static access to css/js/img. Anyway as specified in DJANGO manual

"Django itself doesn’t serve static (media) files, such as images, style sheets, or video. It leaves that job to whichever Web server you choose.
The reasoning here is that standard Web servers, such as Apache, lighttpd and Cherokee, are much more fine-tuned at serving static files than a Web application framework."

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