src/hdabo/config.py.tmpl
author ymh <ymh.work@gmail.com>
Thu, 02 Apr 2015 22:52:54 +0200
changeset 613 4bb38d03e430
parent 359 46ad324f6fe4
permissions -rw-r--r--
upgrade django to 1.8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
359
46ad324f6fe4 Correct qery_dbpedia and improve model.
ymh <ymh.work@gmail.com>
parents: 275
diff changeset
     1
import logging
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
import os
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
270
0f8c8b16cb58 close unwanted head
cavaliet
parents: 266
diff changeset
     5
BASE_URL = '/hdabo/'
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
WEB_URL = 'http://localhost'
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
# Absolute filesystem path to the directory that will hold user-uploaded files.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
# Example: "/home/media/media.lawrence.com/media/"
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
MEDIA_ROOT = os.path.abspath(BASE_DIR + "../static/media/")
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
# trailing slash.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
MEDIA_URL = BASE_URL + "static/media/"
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
# Absolute path to the directory static files should be collected to.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
# Don't put anything in this directory yourself; store your static files
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
# Example: "/home/media/media.lawrence.com/static/"
275
b2eb3e9e6956 first step of folder administration
cavaliet
parents: 273
diff changeset
    21
STATIC_ROOT = os.path.abspath(BASE_DIR + "../../web/static/site/")
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
# URL prefix for static files.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
# Example: "http://media.lawrence.com/static/"
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
STATIC_URL = BASE_URL + "static/site/"
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
# Additional locations of static files
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
STATICFILES_DIRS = (
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
    # Always use forward slashes, even on Windows.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    # Don't forget to use absolute paths, not relative paths.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
DATABASES = {
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
    'default': {
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
        'NAME': 'hdabo',                      # Or path to database file if using sqlite3.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
        'USER': 'iri',                      # Not used with sqlite3.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
        'PASSWORD': 'iri',                  # Not used with sqlite3.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
        'HOST': 'localhost',                      # Set to empty string for localhost. Not used with sqlite3.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
        'PORT': '5432',                      # Set to empty string for default. Not used with sqlite3.
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
    }
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
}
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
273
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    46
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    47
266
825ff4d6a8ac reorganise folders and update venv dependancies (django, etc...)
cavaliet
parents: 176
diff changeset
    48
HAYSTACK_CONNECTIONS = {
825ff4d6a8ac reorganise folders and update venv dependancies (django, etc...)
cavaliet
parents: 176
diff changeset
    49
    'default': {
273
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    50
        # the elasticsearch_backend is probably temporary
266
825ff4d6a8ac reorganise folders and update venv dependancies (django, etc...)
cavaliet
parents: 176
diff changeset
    51
        #'ENGINE': 'hdabo.search.french_whoosh_backend.SearchBackend',
825ff4d6a8ac reorganise folders and update venv dependancies (django, etc...)
cavaliet
parents: 176
diff changeset
    52
        'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
273
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    53
        'URL': 'http://127.0.0.1:9200/',
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    54
        'INDEX_NAME': 'hdabo',
266
825ff4d6a8ac reorganise folders and update venv dependancies (django, etc...)
cavaliet
parents: 176
diff changeset
    55
    },
825ff4d6a8ac reorganise folders and update venv dependancies (django, etc...)
cavaliet
parents: 176
diff changeset
    56
}
11
143ab88d17f8 add ordered manytomany fields and indexing
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    57
273
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    58
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    59
LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt"))
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    60
LOG_LEVEL = logging.DEBUG
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    61
LOGGING = {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    62
    'version': 1,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    63
    'disable_existing_loggers': False,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    64
    'formatters' : {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    65
        'simple' : {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    66
            'format': "%(asctime)s - %(levelname)s : %(message)s",
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    67
        },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    68
        'semi-verbose': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    69
            'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    70
        },                    
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    71
    },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    72
    'handlers': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    73
        'mail_admins': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    74
            'level': 'ERROR',
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    75
            'class': 'django.utils.log.AdminEmailHandler'
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    76
        },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    77
        'stream_to_console': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    78
            'level': LOG_LEVEL,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    79
            'class': 'logging.StreamHandler'
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    80
        },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    81
        'file': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    82
            'level': LOG_LEVEL,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    83
            'class': 'logging.FileHandler',
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    84
            'filename': LOG_FILE,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    85
            'formatter': 'semi-verbose',
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    86
        },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    87
    }            ,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    88
    'loggers': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    89
        'hdabo': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    90
            'handlers': ['file'],
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    91
            'level': LOG_LEVEL,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    92
            'propagate': True,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    93
        },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    94
        'hdalab': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    95
            'handlers': ['file'],
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    96
            'level': LOG_LEVEL,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    97
            'propagate': True,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    98
        },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
    99
#         'django.db.backends':{
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   100
#             'handlers': ['file'],
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   101
#             'level': LOG_LEVEL,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   102
#             'propagate': True,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   103
#         },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   104
#         'django.request': {
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   105
#             'handlers': ['file'],
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   106
#             'level': LOG_LEVEL,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   107
#             'propagate': True,
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   108
#         },
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   109
    }
0fa407857df2 update config template
cavaliet
parents: 272
diff changeset
   110
}