src/iconolab_episteme/settings/dev.py.tmpl
changeset 0 df27f9610c82
child 1 3b0a8a6e685e
equal deleted inserted replaced
-1:000000000000 0:df27f9610c82
       
     1 """
       
     2 Django settings for iconolab 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 import logging
       
    13 import os
       
    14 
       
    15 from iconolab_episteme.settings import *
       
    16 
       
    17 CONTACT_EMAIL = 'youremail@yourprovider.fr'
       
    18 
       
    19 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
       
    20 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
       
    21 
       
    22 STATIC_ROOT = os.path.join(BASE_DIR, '../../web/static/site')
       
    23 MEDIA_ROOT = os.path.join(BASE_DIR, '../../web/media')
       
    24 
       
    25 # dev_mode useful for src_js
       
    26 # We need to add 'iconolab.utils.context_processors.env' to context processor
       
    27 
       
    28 # When JS_DEV_MODE is True, the Webpack dev server should be started
       
    29 JS_DEV_MODE = False
       
    30 # STATICFILES_DIRS = [
       
    31 #     os.path.join(BASE_DIR, 'static'),
       
    32 #     os.path.join(BASE_DIR, 'media'),
       
    33 # ]
       
    34 
       
    35 if JS_DEV_MODE:
       
    36     SRC_JS_PATH = os.path.join(BASE_DIR, '..', '..', 'src_js')
       
    37     STATICFILES_DIRS.append(SRC_JS_PATH)
       
    38 
       
    39 
       
    40 BASE_URL = 'http://localhost:8000'
       
    41 if JS_DEV_MODE:
       
    42     STATIC_URL = 'http://localhost:8001/static/'
       
    43 else:
       
    44     STATIC_URL = '/static/'
       
    45 MEDIA_URL = '/media/'
       
    46 
       
    47 LOGIN_URL = '/account/login/'
       
    48 
       
    49 # Quick-start development settings - unsuitable for production
       
    50 # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
       
    51 
       
    52 # SECURITY WARNING: keep the secret key used in production secret!
       
    53 SECRET_KEY = '#8)+upuo3vc7fi15czxz53ml7*(1__q8hg=m&+9ylq&st1_kqv'
       
    54 
       
    55 # SECURITY WARNING: don't run with debug turned on in production!
       
    56 DEBUG = True
       
    57 THUMBNAIL_DEBUG = True
       
    58 
       
    59 ALLOWED_HOSTS = []
       
    60 
       
    61 
       
    62 # Application definition
       
    63 
       
    64 
       
    65 COMMENTS_APP = "django_comments_xtd"
       
    66 COMMENTS_XTD_MODEL = "iconolab.models.IconolabComment"
       
    67 COMMENTS_XTD_FORM_CLASS = 'iconolab.forms.comments.IconolabCommentForm'
       
    68 COMMENTS_XTD_MAX_THREAD_LEVEL = 1
       
    69 COMMENTS_PER_PAGE_DEFAULT = 10
       
    70 
       
    71 SITE_ID = 1
       
    72 
       
    73 TEMPLATES = [
       
    74     {
       
    75         'BACKEND': 'django.template.backends.django.DjangoTemplates',
       
    76         'DIRS': [os.path.join(BASE_DIR,'iconolab_episteme','templates')],
       
    77         'APP_DIRS': True,
       
    78         'OPTIONS': {
       
    79             'context_processors': [
       
    80                 'django.template.context_processors.debug',
       
    81                 'django.template.context_processors.request',
       
    82                 'django.contrib.auth.context_processors.auth',
       
    83                 'django.contrib.messages.context_processors.messages',
       
    84                 'django.template.context_processors.media',
       
    85                 'django.template.context_processors.static',
       
    86                 'django.template.context_processors.i18n',
       
    87                 'iconolab.utils.context_processors.env',
       
    88             ],
       
    89             'libraries': {
       
    90                 'iconolab_episteme_tags':'iconolab_episteme.templatetags.iconolab_episteme_tags'
       
    91             }
       
    92         },
       
    93     },
       
    94 ]
       
    95 
       
    96 WSGI_APPLICATION = 'iconolab_episteme.wsgi.application'
       
    97 
       
    98 
       
    99 # Database
       
   100 # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
       
   101 
       
   102 DATABASES = {
       
   103     'default': {
       
   104         'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
       
   105         'NAME': '',                      # Or path to database file if using sqlite3.
       
   106         'USER': '',                      # Not used with sqlite3.
       
   107         'PASSWORD': '',                  # Not used with sqlite3.
       
   108         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
       
   109         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
       
   110     }
       
   111 }
       
   112 
       
   113 # Logging
       
   114 
       
   115 LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt"))
       
   116 IMPORT_LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/import_log.txt"))
       
   117 IMPORT_LOGGER_NAME = "import_command"
       
   118 LOG_LEVEL = logging.DEBUG
       
   119 LOGGING = {
       
   120     'version': 1,
       
   121     'disable_existing_loggers': True,
       
   122     'filters': {
       
   123         'require_debug_false': {
       
   124             '()': 'django.utils.log.RequireDebugFalse'
       
   125         }
       
   126     },
       
   127     'formatters' : {
       
   128         'simple' : {
       
   129             'format': "%(asctime)s - %(levelname)s : %(message)s",
       
   130         },
       
   131         'semi-verbose': {
       
   132             'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
       
   133         },
       
   134     },
       
   135     'handlers': {
       
   136         'mail_admins': {
       
   137             'level': 'ERROR',
       
   138             'filters': ['require_debug_false'],
       
   139             'class': 'django.utils.log.AdminEmailHandler'
       
   140         },
       
   141         'stream_to_console': {
       
   142             'level': LOG_LEVEL,
       
   143             'class': 'logging.StreamHandler'
       
   144         },
       
   145         'file': {
       
   146             'level': LOG_LEVEL,
       
   147             'class': 'logging.FileHandler',
       
   148             'filename': LOG_FILE,
       
   149             'formatter': 'semi-verbose',
       
   150         },
       
   151         'import_file': {
       
   152             'level': LOG_LEVEL,
       
   153             'class': 'logging.FileHandler',
       
   154             'filename': IMPORT_LOG_FILE,
       
   155             'formatter': 'semi-verbose',
       
   156         }
       
   157     },
       
   158     'loggers': {
       
   159         'django.request': {
       
   160             'handlers': ['file'],
       
   161             'level': LOG_LEVEL,
       
   162             'propagate': True,
       
   163         },
       
   164         'iconolab': {
       
   165             'handlers': ['file'],
       
   166             'level': LOG_LEVEL,
       
   167             'propagate': True,
       
   168         },
       
   169         'import_command': {
       
   170             'handlers': ['import_file'],
       
   171             'level': LOG_LEVEL,
       
   172             'propagate': True,
       
   173         },
       
   174     }
       
   175 }
       
   176 
       
   177 ELASTICSEARCH_DSL = {
       
   178     'default': {
       
   179         'hosts': 'localhost:9200'
       
   180     },
       
   181 }
       
   182 
       
   183 CACHES = {
       
   184     'default': {
       
   185         'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
       
   186         'LOCATION': os.path.join(MEDIA_ROOT, 'cache'),
       
   187 #        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
       
   188 #        'LOCATION': 'unix:/var/run/memcached/memcached.socket',
       
   189 #        'KEY_PREFIX': 'ldt',
       
   190     }
       
   191 }
       
   192 # Password validation
       
   193 # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
       
   194 
       
   195 AUTH_PASSWORD_VALIDATORS = [
       
   196     {
       
   197         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
       
   198     },
       
   199     {
       
   200         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
       
   201     },
       
   202     {
       
   203         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
       
   204     },
       
   205     {
       
   206         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
       
   207     },
       
   208 ]
       
   209 
       
   210 
       
   211 # Internationalization
       
   212 # https://docs.djangoproject.com/en/1.9/topics/i18n/
       
   213 
       
   214 LANGUAGE_CODE = 'en-us'
       
   215 
       
   216 TIME_ZONE = 'UTC'
       
   217 
       
   218 USE_I18N = True
       
   219 
       
   220 USE_L10N = True
       
   221 
       
   222 USE_TZ = True
       
   223 
       
   224 
       
   225 IMPORT_FIELDS_DICT = {
       
   226     "AUTR": [],
       
   227     "ECOLE": [],
       
   228     "TITR": ["Titre"],
       
   229     "DENO": [],
       
   230     "DOM": ["Domaine"],
       
   231     "APPL": [],
       
   232     "PERI": ["Période"],
       
   233     "MILL": [],
       
   234     "TECH": [],
       
   235     "DIMS": ["Dimensions"],
       
   236     "EPOQ": [],
       
   237     "LIEUX": [],
       
   238     "DECV": [],
       
   239     "LOCA": ["Localisation"],
       
   240     "PHOT": ["Photo"],
       
   241     "INV": ["No inventaire",],
       
   242     "REF": ["REFERENCE"],
       
   243 }
       
   244 
       
   245 INTERNAL_TAGS_URL = BASE_URL
       
   246 JOCONDE_NOTICE_BASE_URL = "http://www.culture.gouv.fr/public/mistral/joconde_fr?ACTION=CHERCHER&FIELD_98=REF&VALUE_98="
       
   247 
       
   248 RELEVANT_TAGS_MIN_SCORE = 3
       
   249 ACCURATE_TAGS_MIN_SCORE = 3