root/trunk/opentrials/settings.py @ 942

Revision 942, 8.2 kB (checked in by antonio.alves, 2 years ago)

Fixing bug #63. Now reviwers can view both public and private attachments

Line 
1# -*- encoding: utf-8 -*-
2
3# OpenTrials: a clinical trials registration system
4#
5# Copyright (C) 2010 BIREME/PAHO/WHO, ICICT/Fiocruz e
6#                    Ministério da Saúde do Brasil
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License as published
10# by the Free Software Foundation, either version 2.1 of the License, or
11# (at your option) any later version.
12
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU Lesser General Public License for more details.
17
18# You should have received a copy of the GNU Lesser General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21import os
22
23DEBUG = False
24TEMPLATE_DEBUG = DEBUG
25PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
26
27ADMINS = (
28    ('Luciano Ramalho', 'luciano.ramalho@bireme.org'),
29    ('Antonio Ribeiro Alves', 'antonio.alves@bireme.org')
30)
31
32MANAGERS = ADMINS
33
34# Local time zone for this installation. Choices can be found here:
35# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
36# although not all choices may be available on all operating systems.
37# If running in a Windows environment this must be set to the same as your
38# system time zone.
39TIME_ZONE = 'America/Sao_Paulo'
40
41# Language code for this installation. All choices can be found here:
42# http://www.i18nguy.com/unicode/language-identifiers.html
43LANGUAGE_CODE = 'pt-BR'
44
45# If you set this to False, Django will make some optimizations so as not
46# to load the internationalization machinery.
47USE_I18N = True
48USE_L10N = True
49
50# Absolute path to the directory that holds media.
51# Example: "/home/media/media.lawrence.com/"
52
53MEDIA_ROOT = os.path.join(PROJECT_PATH, 'static')
54
55# URL that handles the media served from MEDIA_ROOT. Make sure to use a
56# trailing slash if there is a path component (optional in other cases).
57# Examples: "http://media.lawrence.com", "http://example.com/media/"
58MEDIA_URL = '/static/'
59
60# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
61# trailing slash.
62# Examples: "http://foo.com/media/", "/media/".
63ADMIN_MEDIA_PREFIX = '/static/media/'
64
65# Make this unique, and don't share it with anybody.
66SECRET_KEY = '*06=j&&^n71^a&%%3rs%7lla+^(n^v1w@@dp_rxvi#&(xo7meq'
67
68# List of callables that know how to import templates from various sources.
69TEMPLATE_LOADERS = (
70    'django.template.loaders.filesystem.load_template_source',
71    'django.template.loaders.app_directories.load_template_source',
72#     'django.template.loaders.eggs.load_template_source',
73)
74
75MIDDLEWARE_CLASSES = (
76    'django.middleware.gzip.GZipMiddleware',
77    'django.middleware.common.CommonMiddleware',
78    'django.middleware.http.ConditionalGetMiddleware',
79    'django.contrib.sessions.middleware.SessionMiddleware',
80    'django.contrib.auth.middleware.AuthenticationMiddleware',
81    'django.contrib.messages.middleware.MessageMiddleware',
82
83    #'debug_toolbar.middleware.DebugToolbarMiddleware',
84
85    'django.middleware.csrf.CsrfViewMiddleware',
86    'middleware.scriptprefix.ScriptPrefixMiddleware',
87    'django.middleware.locale.LocaleMiddleware',
88    'django.middleware.transaction.TransactionMiddleware',
89    'middleware.user_locale.UserLocaleMiddleware',
90    #'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
91    'flatpages_polyglot.middleware.FlatPagePolyglotMiddleware',
92)
93
94ROOT_URLCONF = 'opentrials.urls'
95LOGIN_REDIRECT_URL = '/accounts/dashboard/'
96
97TEMPLATE_DIRS = (
98    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
99    # Always use forward slashes, even on Windows.
100    # Don't forget to use absolute paths, not relative paths.
101
102    os.path.join(PROJECT_PATH, 'templates'),
103)
104
105INSTALLED_APPS = (
106    'django.contrib.auth',
107    'django.contrib.contenttypes',
108    'django.contrib.sessions',
109    'django.contrib.sites',
110    'django.contrib.admin',
111    'django.contrib.admindocs',
112    'django.contrib.flatpages',
113    'django.contrib.markup',
114    'django.contrib.messages',
115    'deleting',
116    'vocabulary',
117    'repository',
118    'reviewapp',
119    'tickets',
120    'assistance',
121    'decsclient',
122    'icd10client',
123    'diagnostic',
124    'polyglot',
125    'registration',  # django-registration package
126    'flatpages_polyglot',
127    'south',
128    'fossil',
129
130    #'debug_toolbar',
131    'compressor',
132)
133
134TEMPLATE_CONTEXT_PROCESSORS =(
135    'django.core.context_processors.auth',
136    'django.core.context_processors.i18n',
137    'django.core.context_processors.csrf',
138    'django.core.context_processors.media',
139    'django.core.context_processors.request',
140    'context_processors.opentrials.polyglot',
141    'context_processors.opentrials.google_analytics',
142    'context_processors.opentrials.latest_tweets',
143    'context_processors.opentrials.debug',
144    'context_processors.opentrials.default_from_email',
145    'context_processors.opentrials.opentrials_version',
146)
147
148AUTH_PROFILE_MODULE = "reviewapp.UserProfile"
149
150#################################################################
151### BEGIN Clinical Trials Repository customization settings
152###
153### see also settings_local-SAMPLE.py for private customization settings.
154
155# this id must match the record with the correct domain name in the
156# django_site table; the initial values for that table are defined
157# in opentrials/fixtures/initial_data.json
158SITE_ID = 2 # change if necessary to match a record in django_site
159
160SITE_TITLE = u'Registro Brasileiro de Ensaios Clínicos'
161SEND_BROKEN_LINK_EMAILS = True
162DECS_SERVICE = 'http://decs.bvs.br/cgi-bin/mx/cgi=@vmx/decs'
163ICD10_SERVICE = 'http://bases.bireme.br/cgi-bin/mxlindG4.exe/cgi=@cid10/cid10'
164
165TRIAL_ID_PREFIX = 'RBR'
166TRIAL_ID_DIGITS = 6
167
168# Notes:
169# 1) source: http://www.i18nguy.com/unicode/language-identifiers.html
170# 2) the first managed language is considered the default and is
171#    also the source language for content translation purposes
172MANAGED_LANGUAGES_CHOICES = (
173    (u'en', u'English'),
174    (u'es', u'Español'),
175    (u'pt-BR', u'Português'),
176)
177TARGET_LANGUAGES = MANAGED_LANGUAGES_CHOICES[1:] # exlude source language
178MANAGED_LANGUAGES = [code for code, label in MANAGED_LANGUAGES_CHOICES]
179# TODO: implement this as default on new submission forms
180#LANGUAGES = MANAGED_LANGUAGES_CHOICES
181DEFAULT_SUBMISSION_LANGUAGE = u'en'
182
183# django-registration: for how long the activation link is valid
184ACCOUNT_ACTIVATION_DAYS = 7
185
186# django-registration: set to False to suspend new user registrations
187REGISTRATION_OPEN = True
188
189ATTACHMENTS_DIR = 'attachments'
190SUBMISSIONS_XML_PATH = 'submissions_xml'
191
192# Name of Primary Registry
193REG_NAME = 'REBEC'
194
195FIXTURE_DIRS = ('fixtures',)
196
197PAGINATOR_CT_PER_PAGE = 10
198
199TWITTER = 'ensaiosclinicos'
200TWITTER_TIMEOUT = 18000 # expires in 5 min
201
202TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
203NOSE_ARGS = ['--with-coverage', '--with-doctest', '--doctest-tests', '--doctest-extension=txt'] # --doctest-fixtures, --with-profile
204#NOSE_PLUGINS = []
205SKIP_SOUTH_TESTS = True
206SOUTH_TESTS_MIGRATE = False
207
208SESSION_EXPIRE_AT_BROWSER_CLOSE = True
209
210FORMAT_MODULE_PATH = 'formats'
211
212# Backup directory
213BACKUP_DIR = os.path.join(MEDIA_ROOT, 'backup')
214
215INTERNAL_IPS = ('127.0.0.1',)
216USE_ETAGS = True
217
218COMPRESS = True
219COMPRESS_OUTPUT_DIR = 'compressor-cache'
220#COMPRESS_CSS_FILTERS = ['compressor.filters.cssmin.CSSMinFilter']
221#COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.JSMinFilter']
222
223### END Clinical Trials Repository customization settings
224#################################################################
225
226# Deployment settings: there *must* be an unversioned settings_local.include
227# file in the current directory. See sample file at settings_local-SAMPLE.include
228# FIXME: why not use a simple "try: from settings_local import * except ImportError: pass" ?
229execfile(os.path.join(PROJECT_PATH,'settings_local.include'))
230
231#check for write permission in static/attachments, for user's uploads
232ATTACHMENTS_PATH = os.path.join(MEDIA_ROOT, ATTACHMENTS_DIR)
233if os.path.exists(ATTACHMENTS_PATH):
234    if not os.access(ATTACHMENTS_PATH, os.W_OK):
235        raise IOError('Attachments folder "%s" must be writeable' %
236                                (ATTACHMENTS_PATH))
237else:
238    raise IOError('Attachments folder "%s" not found' % (ATTACHMENTS_PATH))
239
240OPENTRIALS_VERSION = 'v1.0.21rc3' # this should be the deployed tag number
Note: See TracBrowser for help on using the browser.