src/iconolab_episteme/settings/__init__.py
changeset 0 df27f9610c82
child 3 16fb4f5efa69
equal deleted inserted replaced
-1:000000000000 0:df27f9610c82
       
     1 """
       
     2 Django settings for iconolab-episteme project.
       
     3 
       
     4 Generated by 'django-admin startproject' using Django 1.9.5.
       
     5 
       
     6 For more information on this file, see
       
     7 https://docs.djangoproject.com/en/1.9/topics/settings/
       
     8 
       
     9 For the full list of settings and their values, see
       
    10 https://docs.djangoproject.com/en/1.9/ref/settings/
       
    11 """
       
    12 
       
    13 import os, logging, sys
       
    14 
       
    15 
       
    16 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
       
    17 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
       
    18 
       
    19 STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../../../run/web/static/site'))
       
    20 MEDIA_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../../../run/web'))
       
    21 
       
    22 BASE_URL = ''
       
    23 STATIC_URL = '/static/'
       
    24 MEDIA_URL = '/media/'
       
    25 
       
    26 LOGIN_URL = '/account/login/'
       
    27 
       
    28 #Static path
       
    29 
       
    30 
       
    31 # Quick-start development settings - unsuitable for production
       
    32 # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
       
    33 
       
    34 # SECURITY WARNING: keep the secret key used in production secret!
       
    35 SECRET_KEY = '#8)+upuo3vc7fi15czxz53ml7*(1__q8hg=m&+9ylq&st1_kqv'
       
    36 
       
    37 # SECURITY WARNING: don't run with debug turned on in production!
       
    38 DEBUG = True
       
    39 THUMBNAIL_DEBUG = True
       
    40 
       
    41 ALLOWED_HOSTS = []
       
    42 
       
    43 
       
    44 # Application definition
       
    45 
       
    46 INSTALLED_APPS = [
       
    47     'iconolab_episteme',
       
    48     'iconolab.apps.IconolabApp',
       
    49     'django.contrib.admin',
       
    50     'django.contrib.auth',
       
    51     'django.contrib.contenttypes',
       
    52     'django.contrib.sessions',
       
    53     'django.contrib.messages',
       
    54     'django.contrib.staticfiles',
       
    55     'django.contrib.sites',
       
    56     'django.contrib.humanize',
       
    57     'django_comments',
       
    58     'django_comments_xtd',
       
    59     'django_elasticsearch_dsl',
       
    60     'sorl.thumbnail',
       
    61     'notifications',
       
    62 ]
       
    63 
       
    64 COMMENTS_APP = "django_comments_xtd"
       
    65 COMMENTS_XTD_MODEL = "iconolab.models.IconolabComment"
       
    66 COMMENTS_XTD_FORM_CLASS = 'iconolab.forms.comments.IconolabCommentForm'
       
    67 COMMENTS_XTD_MAX_THREAD_LEVEL = 100
       
    68 COMMENTS_PER_PAGE_DEFAULT = 10
       
    69 
       
    70 SITE_ID = 1
       
    71 
       
    72 MIDDLEWARE = [
       
    73     'django.middleware.security.SecurityMiddleware',
       
    74     'django.contrib.sessions.middleware.SessionMiddleware',
       
    75     'django.middleware.common.CommonMiddleware',
       
    76     'django.middleware.csrf.CsrfViewMiddleware',
       
    77     'django.contrib.auth.middleware.AuthenticationMiddleware',
       
    78     'django.contrib.messages.middleware.MessageMiddleware',
       
    79     'django.middleware.clickjacking.XFrameOptionsMiddleware',
       
    80 ]
       
    81 
       
    82 ROOT_URLCONF = 'iconolab_episteme.urls'
       
    83 
       
    84 TEMPLATES = [
       
    85     {
       
    86         'BACKEND': 'django.template.backends.django.DjangoTemplates',
       
    87         'DIRS': [os.path.join(BASE_DIR,'iconolab_episteme', 'templates')],
       
    88         'APP_DIRS': True,
       
    89         'OPTIONS': {
       
    90             'context_processors': [
       
    91                 'django.template.context_processors.debug',
       
    92                 'django.template.context_processors.request',
       
    93                 'django.contrib.auth.context_processors.auth',
       
    94                 'django.contrib.messages.context_processors.messages',
       
    95                 'django.core.context_processors.media',
       
    96                 'django.core.context_processors.static',
       
    97                 'django.core.context_processors.i18n',
       
    98                 'iconolab.utils.context_processors.env',
       
    99             ],
       
   100         },
       
   101     },
       
   102 ]
       
   103 
       
   104 WSGI_APPLICATION = 'iconolab_episteme.wsgi.application'
       
   105 
       
   106 
       
   107 # Database
       
   108 # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
       
   109 CACHES = {
       
   110     'default': {
       
   111         'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
       
   112         'LOCATION': os.path.join(MEDIA_ROOT, 'cache'),
       
   113 #        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
       
   114 #        'LOCATION': 'unix:/var/run/memcached/memcached.socket',
       
   115 #        'KEY_PREFIX': 'ldt',
       
   116     }
       
   117 }
       
   118 # Password validation
       
   119 # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
       
   120 
       
   121 AUTH_PASSWORD_VALIDATORS = [
       
   122     {
       
   123         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
       
   124     },
       
   125     {
       
   126         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
       
   127     },
       
   128     {
       
   129         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
       
   130     },
       
   131     {
       
   132         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
       
   133     },
       
   134 ]
       
   135 
       
   136 
       
   137 # Internationalization
       
   138 # https://docs.djangoproject.com/en/1.9/topics/i18n/
       
   139 
       
   140 TIME_ZONE = 'UTC'
       
   141 
       
   142 USE_I18N = True
       
   143 
       
   144 USE_L10N = True
       
   145 
       
   146 USE_TZ = True
       
   147 
       
   148 # IMPORT_DEFAULT_FIELD_TO_FILENAME_IDENTIFIER = "INV"
       
   149 NO_IMG_CONVERSION_EXTS = [".jpg"]
       
   150 IMG_CONVERSION_EXTS = [".tif", ".tiff"]
       
   151 IMG_JPG_DEFAULT_QUALITY = 80
       
   152 PREGENERATE_THUMBNAILS_SIZES = [
       
   153     # item_images_preview.html
       
   154     "250x250",
       
   155     "100x100",
       
   156 ]
       
   157 IMPORT_LOG_FILE = ""
       
   158 IMPORT_LOGGER_NAME = ""
       
   159 
       
   160 DJANGO_RUNSERVER = (len(sys.argv)>1 and sys.argv[1] == 'runserver')
       
   161 
       
   162 RELEVANT_TAGS_MIN_SCORE = 3
       
   163 ACCURATE_TAGS_MIN_SCORE = 3
       
   164 
       
   165 # The different thumbnail sizes that we want to pre-generate when importing or when updating collections using commands
       
   166 # This allows to pre-calculate thumbnails for media-heavy pages such as collection_home
       
   167