123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- """
- Django settings for visualization project.
- For more information on this file, see
- https://docs.djangoproject.com/en/1.7/topics/settings/
- For the full list of settings and their values, see
- https://docs.djangoproject.com/en/1.7/ref/settings/
- """
- # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
- import os
- from . import settings_env
- from mongoengine import register_connection
- BASE_DIR = os.path.dirname(os.path.dirname(__file__))
- ENVIRONMENT = settings_env.ENVIRONMENT
- globalConfiguration = settings_env.globalConfiguration
- PATH_TIFF_SEQUENCER = globalConfiguration['sequencer']
- if os.path.exists(PATH_TIFF_SEQUENCER) is False:
- os.makedirs(PATH_TIFF_SEQUENCER)
- PATH_MMAP = globalConfiguration['mmap-folder']
- if os.path.exists(PATH_MMAP) is False:
- os.makedirs(PATH_MMAP)
- PATH_FIJI = globalConfiguration['fiji-path']
- DEFAULT_IMPORT_PATH = globalConfiguration['default-import-path']
- # good value may be 676 = 26 ^ 2
- MAX_NUMBER_SLICES_PER_MAP = 700.0
- # defaul: True
- Z_DOWNSCALING_ACTIVATED = False
- # default: False
- REDUCE_HARDDISK_ACCESS_FOR_DEV = globalConfiguration['reduce-harddisk-access']
- MAX_NUMBER_SLICES_PER_MAP = float(MAX_NUMBER_SLICES_PER_MAP)
- # Quick-start development settings - unsuitable for production
- # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
- # SECURITY WARNING: keep the secret key used in production secret!
- SECRET_KEY = '8sd=-3bl&j4r@#43x6nsihb(ppytmu6y0n255=5@m10yh=k*e3'
- # SECURITY WARNING: don't run with debug turned on in production!
- DEBUG = True
- TEMPLATE_DEBUG = True
- ALLOWED_HOSTS = []
- SUBVOLUME_STATIC = False
- # seconds
- SUBVOLUME_CACHING_TIME = 180
- # Application definition
- INSTALLED_APPS = (
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'volumes',
- 'loadtests'
- )
- MIDDLEWARE_CLASSES = (
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django.middleware.clickjacking.XFrameOptionsMiddleware',
- )
- TEMPLATE_CONTEXT_PROCESSORS = (
- "django.contrib.auth.context_processors.auth",
- "django.core.context_processors.debug",
- "django.core.context_processors.i18n",
- "django.core.context_processors.media",
- "django.core.context_processors.static",
- "django.core.context_processors.tz",
- "django.contrib.messages.context_processors.messages",
- "django.core.context_processors.request",
- "visualization.context_processor.add_settings"
- )
- ROOT_URLCONF = 'visualization.urls'
- WSGI_APPLICATION = 'visualization.wsgi.application'
- TEMPLATE_DIRS = (
- os.path.join(BASE_DIR, 'templates'), 'templates'
- )
- # Database
- # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
- DATABASES = {
- 'default': {
- 'ENGINE': '',
- },
- }
- CACHES = {
- 'default': {
- 'BACKEND': 'visualization.memcached.MemcachedCache',
- 'LOCATION': '127.0.0.1:11211',
- }
- }
- ''' logger configuration for each environment '''
- loggerConfiguration = {}
- loggerConfiguration['prod'] = {}
- loggerConfiguration['staging'] = {}
- loggerConfiguration['dev'] = {}
- loggerConfiguration['prod']['django'] = ['django-file']
- loggerConfiguration['prod']['django-request'] = ['django-file']
- loggerConfiguration['prod']['visualization'] = ['visualization-file']
- loggerConfiguration['prod']['volumes'] = ['visualization-file']
- loggerConfiguration['prod']['volumes-processing'] = ['visualization-processing-file']
- loggerConfiguration['staging'] = loggerConfiguration['prod']
- loggerConfiguration['dev']['django'] = []
- loggerConfiguration['dev']['django-request'] = []
- loggerConfiguration['dev']['visualization'] = ['visualization-file']
- loggerConfiguration['dev']['volumes'] = ['visualization-file']
- loggerConfiguration['dev']['volumes-processing'] = ['console']
- LOGGING = {
- 'version': 1,
- 'disable_existing_loggers': True,
- 'formatters': {
- 'verbose': {
- 'format': '%(levelname)s %(asctime)s %(pathname)s %(process)d %(message)s'
- },
- 'simple': {
- 'format': '%(levelname)s %(message)s'
- },
- },
- 'handlers': {
- 'django-file': {
- 'level': 'DEBUG',
- 'class': 'logging.FileHandler',
- 'filename': globalConfiguration['log-base-path'] + '-django.log',
- 'formatter': 'simple'
- },
- 'visualization-file': {
- 'level': 'DEBUG',
- 'class': 'logging.FileHandler',
- 'filename': globalConfiguration['log-base-path'] + '.log',
- 'formatter': 'verbose'
- },
- 'visualization-processing-file': {
- 'level': 'DEBUG',
- 'class': 'logging.FileHandler',
- 'filename': globalConfiguration['log-base-path'] + '-processing.log',
- 'formatter': 'verbose'
- },
- 'visualization-processing-subvolume-file': {
- 'level': 'DEBUG',
- 'class': 'logging.FileHandler',
- 'filename': globalConfiguration['log-base-path'] + '-processing-subvolume.log',
- 'formatter': 'verbose'
- },
- 'console': {
- 'level': 'DEBUG',
- 'class': 'logging.StreamHandler'
- },
- },
- 'loggers': {
- 'django': {
- 'handlers': loggerConfiguration[ENVIRONMENT]['django'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'django.request': {
- 'handlers': loggerConfiguration[ENVIRONMENT]['django-request'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'visualization': {
- 'handlers': loggerConfiguration[ENVIRONMENT]['visualization'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'volumes': {
- 'handlers': loggerConfiguration[ENVIRONMENT]['volumes'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'volumes.processing': {
- 'handlers': loggerConfiguration[ENVIRONMENT]['volumes-processing'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'imageprocessing': {
- 'handlers': loggerConfiguration[ENVIRONMENT]['volumes-processing'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- },
- }
- # Internationalization
- # https://docs.djangoproject.com/en/1.7/topics/i18n/
- LANGUAGE_CODE = 'en-us'
- TIME_ZONE = 'UTC'
- USE_I18N = True
- USE_L10N = True
- USE_TZ = True
- # Static files (CSS, JavaScript, Images)
- # https://docs.djangoproject.com/en/1.7/howto/static-files/
- STATIC_URL = globalConfiguration['static-url-prefix'] + '/static/'
- STATICFILES_DIRS = (
- os.path.join(BASE_DIR, "static"), ''
- )
- SESSION_ENGINE = 'mongoengine.django.sessions'
- MONGO_DATABASE_NAME = globalConfiguration['db-name']
- MONGO_DATABASE_TESTRESULT_NAME = globalConfiguration['db-name-tests-results']
- register_connection('default', MONGO_DATABASE_NAME)
- register_connection('test_results', MONGO_DATABASE_TESTRESULT_NAME)
- # this line has to be after SECRET_KEY
- from django.core.cache import cache
- cache.set('test', True)
- if cache.get('test') is None:
- import logging
- logging.getLogger(__name__).error('cache backend not available')
|