2017-06-27 15:43:02 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import logbook
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from mako.lookup import TemplateLookup
|
|
|
|
from logbook import Logger, StreamHandler, RotatingFileHandler
|
2017-09-21 23:24:18 -05:00
|
|
|
logbook.set_datetime_format('local')
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
|
2017-09-30 00:22:55 -05:00
|
|
|
DEBUG = True
|
|
|
|
VERSION = '0.1.0'
|
|
|
|
EMAIL_SUPPORT = ('soporte@empresalibre.net',)
|
2017-06-27 15:43:02 -05:00
|
|
|
|
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
PATH_STATIC = os.path.abspath(os.path.join(BASE_DIR, '..'))
|
|
|
|
PATH_TEMPLATES = os.path.abspath(os.path.join(BASE_DIR, '..', 'templates'))
|
|
|
|
|
2017-09-30 00:22:55 -05:00
|
|
|
PATH_CP = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'cp.db'))
|
|
|
|
COMPANIES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'rfc.db'))
|
2017-10-04 00:11:49 -05:00
|
|
|
DB_SAT = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'sat.db'))
|
2017-06-27 15:43:02 -05:00
|
|
|
|
2017-10-10 18:49:05 -05:00
|
|
|
PATH_XSLT = os.path.abspath(os.path.join(BASE_DIR, '..', 'xslt'))
|
|
|
|
PATH_BIN = os.path.abspath(os.path.join(BASE_DIR, '..', 'bin'))
|
|
|
|
|
2017-06-27 15:43:02 -05:00
|
|
|
template_lookup = TemplateLookup(directories=[PATH_TEMPLATES],
|
|
|
|
input_encoding='utf-8',
|
|
|
|
output_encoding='utf-8')
|
|
|
|
|
|
|
|
LOG_PATH = 'empresalibre.log'
|
|
|
|
LOG_NAME = 'API'
|
|
|
|
LOG_LEVEL = 'INFO'
|
|
|
|
|
|
|
|
format_string = '[{record.time:%d-%b-%Y %H:%M:%S}] ' \
|
|
|
|
'{record.level_name}: ' \
|
|
|
|
'{record.channel}: ' \
|
|
|
|
'{record.message}'
|
|
|
|
|
|
|
|
if DEBUG:
|
|
|
|
LOG_LEVEL = 'DEBUG'
|
|
|
|
StreamHandler(
|
|
|
|
sys.stdout,
|
|
|
|
level=LOG_LEVEL,
|
|
|
|
format_string=format_string).push_application()
|
|
|
|
else:
|
|
|
|
LOG_PATH = '/srv/log/empresalibre.log'
|
|
|
|
RotatingFileHandler(
|
|
|
|
LOG_PATH,
|
|
|
|
backup_count=10,
|
|
|
|
max_size=1073741824,
|
|
|
|
level=LOG_LEVEL,
|
|
|
|
format_string=format_string).push_application()
|
|
|
|
|
|
|
|
log = Logger(LOG_NAME)
|
|
|
|
|
2017-10-10 18:49:05 -05:00
|
|
|
|
|
|
|
PATH_XSLTPROC = 'xsltproc'
|
|
|
|
PATH_OPENSSL = 'openssl'
|
|
|
|
if 'win' in sys.platform:
|
|
|
|
PATH_XSLTPROC = os.path.join(PATH_BIN, 'xsltproc.exe')
|
|
|
|
PATH_OPENSSL = os.path.join(PATH_BIN, 'openssl.exe')
|