src/ldtplatform/config_docker.py
changeset 322 3a80a07f1300
equal deleted inserted replaced
321:cedbb7804a7b 322:3a80a07f1300
       
     1 # -*- coding: utf-8 -*-
       
     2 import os, logging
       
     3 
       
     4 SITE_ID = 1
       
     5 
       
     6 
       
     7 BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
       
     8 BASE_URL = '/'
       
     9 PLATFORM_BASE_URL = '/'
       
    10 LOGIN_REDIRECT_URL = '/ldt'
       
    11 LOGOUT_REDIRECT_URL = '/ldt'
       
    12 WEB_URL = ''
       
    13 WEB_AUTH = [] # example [{'REGEX': 'localhost/~ymh/platform', 'NAME': 'ymh', 'PASSWORD': 'ymh'}]
       
    14 STATIC_URL = BASE_URL + 'static/site/'
       
    15 
       
    16 
       
    17 STREAM_SRC_PREFIX = ""
       
    18 
       
    19 BASE_STATIC_URL = WEB_URL + BASE_URL + 'static/'
       
    20 BASE_STATIC_ROOT = os.path.abspath(BASE_DIR + "../../web/static/").rstrip("/")+"/"
       
    21 
       
    22 STREAM_URL = BASE_STATIC_URL + "/content/"
       
    23 
       
    24 # Absolute path to the directory that holds media.
       
    25 # Example: "/home/media/media.lawrence.com/"
       
    26 MEDIA_ROOT = BASE_STATIC_ROOT + "media/"
       
    27 
       
    28 
       
    29 # Absolute path to the directory that static files (js, css, swf...)
       
    30 # DO NOT forget to do command line ./manage.py collectstatic to gather static media into the web/static folder
       
    31 STATIC_ROOT = BASE_STATIC_ROOT + "site/"
       
    32 
       
    33 # Make this unique, and don't share it with anybody.
       
    34 SECRET_KEY = 'vu6choo7ahk4loaj4lie1thiegh0cae4quohtohnee7ooshaN1'
       
    35 
       
    36 # PATH to the ffmpeg executable, used to know automatically the media file duration 
       
    37 FFMPEG_PATH = ""
       
    38 
       
    39 
       
    40 CONTENT_ROOT = BASE_STATIC_ROOT + "content/"
       
    41 
       
    42 # PATH where uploaded media are put.
       
    43 STREAM_PATH = CONTENT_ROOT
       
    44 
       
    45 LDT_MEDIA_PREFIX = STATIC_URL + 'ldt/'
       
    46 
       
    47 
       
    48 DATABASES = {
       
    49     'default': {
       
    50         'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
       
    51         'NAME': 'postgres',                      # Or path to database file if using sqlite3.
       
    52         'USER': 'postgres',                      # Not used with sqlite3.
       
    53         'PASSWORD': '',                  # Not used with sqlite3.
       
    54         'HOST': 'db',                      # Set to empty string for localhost. Not used with sqlite3.
       
    55         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
       
    56     }
       
    57 }
       
    58 
       
    59 CACHES = {
       
    60     'default': {
       
    61         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
       
    62     }
       
    63 }
       
    64 
       
    65 DEBUG = True
       
    66 TEMPLATE_DEBUG = DEBUG
       
    67 
       
    68 LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt"))
       
    69 LOG_LEVEL = logging.DEBUG
       
    70 LOGGING = {
       
    71     'version': 1,
       
    72     'disable_existing_loggers': False,
       
    73     'filters': {
       
    74         'require_debug_false': {
       
    75             '()': 'django.utils.log.RequireDebugFalse'
       
    76         }
       
    77     },
       
    78     'formatters' : {
       
    79         'simple' : {
       
    80             'format': "%(asctime)s - %(levelname)s : %(message)s",
       
    81         },
       
    82         'semi-verbose': {
       
    83             'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
       
    84         },                    
       
    85     },
       
    86     'handlers': {
       
    87         'mail_admins': {
       
    88             'level': 'ERROR',
       
    89             'filters': ['require_debug_false'],
       
    90             'class': 'django.utils.log.AdminEmailHandler'
       
    91         },
       
    92         'stream_to_console': {
       
    93             'level': LOG_LEVEL,
       
    94             'class': 'logging.StreamHandler'
       
    95         },
       
    96         'file': {
       
    97             'level': LOG_LEVEL,
       
    98             'class': 'logging.FileHandler',
       
    99             'filename': LOG_FILE,
       
   100             'formatter': 'semi-verbose',
       
   101         },
       
   102     },
       
   103     'loggers': {
       
   104         'django.db.backends':{
       
   105             'handlers': ['file'],
       
   106             'level': LOG_LEVEL,
       
   107             'propagate': True,
       
   108         },                
       
   109         'django.request': {
       
   110             'handlers': ['file'],
       
   111             'level': LOG_LEVEL,
       
   112             'propagate': True,
       
   113         },
       
   114         'ldt': {
       
   115             'handlers': ['file'],
       
   116             'level': LOG_LEVEL,
       
   117             'propagate': True,
       
   118         },
       
   119     }
       
   120 }
       
   121 
       
   122 
       
   123 ADMINS = (
       
   124     # ('Your Name', 'your_email@domain.com'),
       
   125 )
       
   126 
       
   127 MANAGERS = ADMINS
       
   128 
       
   129 GOOGLE_ANALYTICS_CODE = '%(google_analytics_code)s'
       
   130 
       
   131 EMAIL_USE_TLS = False
       
   132 EMAIL_HOST = ''
       
   133 EMAIL_HOST_USER = ''
       
   134 EMAIL_HOST_PASSWORD = ''
       
   135 EMAIL_PORT = 25 
       
   136 
       
   137 ACCOUNT_ACTIVATION_DAYS = 7
       
   138 REGISTRATION_OPEN = False
       
   139 
       
   140 LDT_MAX_SEARCH_NUMBER = 50
       
   141 LDT_MAX_FRAGMENT_PER_SEARCH = 3
       
   142 LDT_RESULTS_PER_PAGE = 1
       
   143 LDT_JSON_DEFAULT_INDENT = 0
       
   144 LDT_MAX_CONTENTS_PER_PAGE = 5
       
   145 LDT_MAX_PROJECTS_PER_PAGE = 5
       
   146 LDT_FRONT_MEDIA_PER_PAGE = 9
       
   147 
       
   148 EMPTY_MEDIA_EXTERNALID = None
       
   149 
       
   150 AUTO_INDEX_AFTER_SAVE = True
       
   151 
       
   152 FORBIDDEN_STREAM_URL = "%(forbidden_stream_url)s"
       
   153 
       
   154 AUDIO_RECORD_URL = "%(audio_record_url)s"
       
   155 
       
   156 FRONT_TAG_LIST = [u"Enmi 2011", u"film", u"conférence"]
       
   157 
       
   158 HAYSTACK_CONNECTIONS = {
       
   159     'default': {
       
   160         #for elasticsearch use ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine
       
   161         'ENGINE': 'ldt.indexation.backends.elasticsearch_backend.ElasticsearchSearchEngine',
       
   162         'URL': 'es:9200/',
       
   163         'INDEX_NAME': 'ldt',
       
   164     },
       
   165 }
       
   166 
       
   167 LDT_INDEXATION_INSERT_BATCH_SIZE = 5000