src/hp/config.py.tmpl
changeset 38 0fe2f3f5466f
child 45 316a0101512e
equal deleted inserted replaced
37:b4ed8cdc654c 38:0fe2f3f5466f
       
     1 # -*- coding: utf-8 -*-
       
     2 '''
       
     3 Created on Oct 23, 2012
       
     4 
       
     5 @author: ymh
       
     6 '''
       
     7 import os, logging
       
     8 
       
     9 DATABASES = {
       
    10     'default': {
       
    11         'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
       
    12         'NAME': '',                      # Or path to database file if using sqlite3.
       
    13         'USER': '',                      # Not used with sqlite3.
       
    14         'PASSWORD': '',                  # Not used with sqlite3.
       
    15         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
       
    16         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
       
    17     }
       
    18 }
       
    19 
       
    20 # Local time zone for this installation. Choices can be found here:
       
    21 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
       
    22 # although not all choices may be available on all operating systems.
       
    23 # In a Windows environment this must be set to your system time zone.
       
    24 TIME_ZONE = 'Europe/Paris'
       
    25 
       
    26 # Language code for this installation. All choices can be found here:
       
    27 # http://www.i18nguy.com/unicode/language-identifiers.html
       
    28 LANGUAGE_CODE = 'en-us'
       
    29 
       
    30 BASE_ROOT = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
       
    31 BASE_URL = '%(base_url)s'
       
    32 BASE_STATIC_URL = BASE_URL + 'static/'
       
    33 
       
    34 # Absolute filesystem path to the directory that will hold user-uploaded files.
       
    35 # Example: "/home/media/media.lawrence.com/media/"
       
    36 MEDIA_ROOT = os.path.abspath(BASE_ROOT + "../../web/static/media").rstrip("/")+"/"
       
    37 
       
    38 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
       
    39 # trailing slash.
       
    40 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
       
    41 MEDIA_URL = BASE_STATIC_URL + "media"
       
    42 
       
    43 # Absolute path to the directory static files should be collected to.
       
    44 # Don't put anything in this directory yourself; store your static files
       
    45 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
       
    46 # Example: "/home/media/media.lawrence.com/static/"
       
    47 STATIC_ROOT = os.path.abspath(BASE_ROOT + "../../web/static/site").rstrip("/")+"/"
       
    48 
       
    49 # URL prefix for static files.
       
    50 # Example: "http://media.lawrence.com/static/"
       
    51 STATIC_URL = BASE_STATIC_URL + "site"
       
    52 
       
    53 # A sample logging configuration. The only tangible logging
       
    54 # performed by this configuration is to send an email to
       
    55 # the site admins on every HTTP 500 error when DEBUG=False.
       
    56 # See http://docs.djangoproject.com/en/dev/topics/logging for
       
    57 # more details on how to customize your logging configuration.
       
    58 LOG_FILE = os.path.abspath(os.path.join(BASE_ROOT,"../log/log.txt"))
       
    59 LOG_LEVEL = logging.DEBUG
       
    60 
       
    61 LOGGING = {
       
    62     'version': 1,
       
    63     'disable_existing_loggers': False,
       
    64     'formatters' : {
       
    65         'simple' : {
       
    66             'format': "%(asctime)s - %(levelname)s : %(message)s",
       
    67         },
       
    68         'semi-verbose': {
       
    69             'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
       
    70         },                    
       
    71     },
       
    72     'handlers': {
       
    73         'mail_admins': {
       
    74             'level': 'ERROR',
       
    75             'class': 'django.utils.log.AdminEmailHandler'
       
    76         },
       
    77         'stream_to_console': {
       
    78             'level': LOG_LEVEL,
       
    79             'class': 'logging.StreamHandler'
       
    80         },
       
    81         'file': {
       
    82             'level': LOG_LEVEL,
       
    83             'class': 'logging.FileHandler',
       
    84             'filename': LOG_FILE,
       
    85             'formatter': 'semi-verbose',
       
    86         },
       
    87     },
       
    88     'loggers': {
       
    89         'django.db.backends':{
       
    90             'handlers': ['file'],
       
    91             'level': LOG_LEVEL,
       
    92             'propagate': True,
       
    93         },                
       
    94         'django.request': {
       
    95             'handlers': ['file'],
       
    96             'level': LOG_LEVEL,
       
    97             'propagate': True,
       
    98         },
       
    99         'hp': {
       
   100             'handlers': ['file'],
       
   101             'level': LOG_LEVEL,
       
   102             'propagate': True,
       
   103         },
       
   104     }
       
   105 }
       
   106 
       
   107 LDT_DOMAIN = 'http://localhost'
       
   108 LDT_API_URL = LDT_DOMAIN + '/~ymh/hp_ldt/ldtplatform/api/1.0/'
       
   109 
       
   110