docker/server/config.py
changeset 702 2a6e667b1610
equal deleted inserted replaced
691:8454f9cda0ca 702:2a6e667b1610
       
     1 # -*- coding: utf-8 -*-
       
     2 '''
       
     3 Created on Jan 26, 2012
       
     4 
       
     5 @author: ymh
       
     6 '''
       
     7 import logging
       
     8 import os
       
     9 
       
    10 from environs import Env
       
    11  
       
    12 env = Env()
       
    13 # Read .env into os.environ
       
    14 env.read_env()
       
    15 
       
    16 DEBUG = env.bool("DEBUG", default=False)
       
    17 TEMPLATE_DEBUG = DEBUG
       
    18 
       
    19 ADMINS = (
       
    20     ('Hdalab admin', env.str("ADMIN_EMAIL")),
       
    21 )
       
    22 
       
    23 MANAGERS = ADMINS
       
    24 
       
    25 DATABASES = {
       
    26     'default': env.dj_db_url("DATABASE_URL"),
       
    27 }
       
    28 
       
    29 CACHES = {
       
    30     'default': {
       
    31         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
       
    32         'LOCATION': 'cache:11211',
       
    33         'KEY_PREFIX': 'hdalab2',
       
    34         'TIMEOUT': 500,
       
    35     }
       
    36 }
       
    37 
       
    38 BASE_DIR = "/code/"
       
    39 BASE_URL = '/'
       
    40 WEB_URL = 'https://hdalab.iri-research.org'
       
    41 SCRIPT_PREFIX = BASE_URL + 'hdalab'
       
    42 
       
    43 LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale',), )
       
    44 
       
    45 # Absolute filesystem path to the directory that will hold user-uploaded files.
       
    46 # Example: "/home/media/media.lawrence.com/media/"
       
    47 MEDIA_ROOT = "/static/media/"
       
    48 
       
    49 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
       
    50 # trailing slash.
       
    51 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
       
    52 MEDIA_URL = BASE_URL + "static/media/"
       
    53 
       
    54 # Absolute path to the directory static files should be collected to.
       
    55 # Don't put anything in this directory yourself; store your static files
       
    56 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
       
    57 # Example: "/home/media/media.lawrence.com/static/"
       
    58 STATIC_ROOT = "/static/site/"
       
    59 
       
    60 # URL prefix for static files.
       
    61 # Example: "http://media.lawrence.com/static/"
       
    62 STATIC_URL = BASE_URL + "static/site/"
       
    63 
       
    64 # URL prefix for admin static files -- CSS, JavaScript and images.
       
    65 # Make sure to use a trailing slash.
       
    66 # Examples: "http://foo.com/static/admin/", "/static/admin/".
       
    67 ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
       
    68 
       
    69 # Hosts/domain names that are valid for this site; required if DEBUG is False
       
    70 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
       
    71 ALLOWED_HOSTS = ['hdalab.iri-research.org']
       
    72 
       
    73 # Local time zone for this installation. Choices can be found here:
       
    74 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
       
    75 # although not all choices may be available on all operating systems.
       
    76 # In a Windows environment this must be set to your system time zone.
       
    77 TIME_ZONE = 'Europe/Paris'
       
    78 
       
    79 # Language code for this installation. All choices can be found here:
       
    80 # http://www.i18nguy.com/unicode/language-identifiers.html
       
    81 LANGUAGE_CODE = 'fr-FR'
       
    82 
       
    83 SITE_ID = 1
       
    84 
       
    85 #if you set this to False, Django will not use timezone-aware datetimes.
       
    86 USE_TZ = True
       
    87 
       
    88 HAYSTACK_CONNECTIONS = {
       
    89     'default': {
       
    90         'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
       
    91         'URL': "http://"+env.str("ES_HOST", default="es")+":9200",
       
    92         'INDEX_NAME': 'jocondelab',
       
    93     },
       
    94 }
       
    95 
       
    96 # Make this unique, and don't share it with anybody.
       
    97 SECRET_KEY = env.str("DJANGO_SECRET")
       
    98 
       
    99 #LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt"))
       
   100 LOG_LEVEL = logging.INFO
       
   101 
       
   102 LOGGING = {
       
   103     'version': 1,
       
   104     'disable_existing_loggers': False,
       
   105     'filters': {
       
   106         'require_debug_false': {
       
   107             '()': 'django.utils.log.RequireDebugFalse'
       
   108         }
       
   109     },
       
   110     'formatters' : {
       
   111         'simple' : {
       
   112             'format': "%(asctime)s - %(levelname)s : %(message)s",
       
   113         },
       
   114         'semi-verbose': {
       
   115             'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
       
   116         },
       
   117     },
       
   118     'handlers': {
       
   119         'stream_to_console': {
       
   120             'level': LOG_LEVEL,
       
   121             'class': 'logging.StreamHandler'
       
   122         },
       
   123     },
       
   124     'loggers': {
       
   125         'django.request': {
       
   126             'handlers': ['stream_to_console'],
       
   127             'level': 'ERROR',
       
   128             'propagate': True,
       
   129         },
       
   130         'hdabo': {
       
   131             'handlers': ['stream_to_console'],
       
   132             'level': 'DEBUG',
       
   133             'propagate': True,
       
   134         },
       
   135         'hdalab': {
       
   136             'handlers': ['stream_to_console'],
       
   137             'level': 'DEBUG',
       
   138             'propagate': True,
       
   139         },
       
   140         'core': {
       
   141             'handlers': ['stream_to_console'],
       
   142             'level': 'DEBUG',
       
   143             'propagate': True,
       
   144         },
       
   145         'rdflib_sqlalchemy': {
       
   146             'handlers': ['stream_to_console'],
       
   147             'level': 'DEBUG',
       
   148             'propagate': True,
       
   149         },
       
   150     }
       
   151 }
       
   152 
       
   153 
       
   154 USE_ETAGS = False
       
   155 
       
   156 GOOGLE_ANALYTICS_CODE = None
       
   157 
       
   158 DEFAULT_FROM_EMAIL = "do-not-reply@iri-research.org"
       
   159 
       
   160 ENVELOPE_EMAIL_RECIPIENTS= ['histoiredesarts@culture.gouv.fr']
       
   161 
       
   162 RENKAN_PREVIEW_PHANTOMJS_PATH = '/usr/local/bin/phantomjs'
       
   163 
       
   164 BROKER_URL = 'amqp://iri:'+ env.str('BROKER_PASSWORD') +'@broker:5672/hdalab'
       
   165 
       
   166 RENKAN_TUTORIAL_VIDEO_URLS = [
       
   167     {'format': 'video/mp4', 'url': 'http://media.iri.centrepompidou.fr/video/hdalab/hdalab_renkan_presentation_720p.mp4' },
       
   168     {'format': 'video/webm', 'url': 'http://media.iri.centrepompidou.fr/video/hdalab/hdalab_renkan_presentation_720p.webm' },
       
   169     {'format': 'video/ogg', 'url': 'http://media.iri.centrepompidou.fr/video/hdalab/hdalab_renkan_presentation_720p.ogv' }
       
   170 ]
       
   171 
       
   172 WIKIPEDIA_API_URL = "https://fr.wikipedia.org/w/api.php"
       
   173 
       
   174