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