forked from elmau/empresa-libre
96 lines
2.7 KiB
Python
96 lines
2.7 KiB
Python
#!/usr/bin/env python
|
|
|
|
import logbook
|
|
import os
|
|
import sys
|
|
from mako.lookup import TemplateLookup
|
|
from logbook import Logger, StreamHandler, RotatingFileHandler
|
|
logbook.set_datetime_format('local')
|
|
|
|
from conf import DEBUG
|
|
|
|
|
|
DEBUG = DEBUG
|
|
VERSION = '0.2.0'
|
|
EMAIL_SUPPORT = ('soporte@empresalibre.net',)
|
|
|
|
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'))
|
|
PATH_MEDIA = os.path.abspath(os.path.join(BASE_DIR, '..', 'docs'))
|
|
|
|
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'))
|
|
DB_SAT = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'sat.db'))
|
|
|
|
IV = 'valores_iniciales.json'
|
|
INIT_VALUES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', IV))
|
|
CT = 'cancel_template.xml'
|
|
TEMPLATE_CANCEL = os.path.abspath(os.path.join(PATH_TEMPLATES, CT))
|
|
|
|
PATH_XSLT = os.path.abspath(os.path.join(BASE_DIR, '..', 'xslt'))
|
|
PATH_BIN = os.path.abspath(os.path.join(BASE_DIR, '..', 'bin'))
|
|
|
|
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:
|
|
#~ Establece una ruta con acceso para nginx o el servidor web que uses
|
|
LOG_PATH = '/srv/log/empresalibre.log'
|
|
RotatingFileHandler(
|
|
LOG_PATH,
|
|
backup_count=10,
|
|
max_size=1073741824,
|
|
level=LOG_LEVEL,
|
|
format_string=format_string).push_application()
|
|
|
|
StreamHandler(
|
|
sys.stdout,
|
|
level=LOG_LEVEL,
|
|
format_string=format_string).push_application()
|
|
|
|
|
|
log = Logger(LOG_NAME)
|
|
|
|
|
|
PATH_XSLTPROC = 'xsltproc'
|
|
PATH_OPENSSL = 'openssl'
|
|
PATH_XMLSEC = 'xmlsec1'
|
|
if 'win' in sys.platform:
|
|
PATH_XSLTPROC = os.path.join(PATH_BIN, 'xsltproc.exe')
|
|
PATH_OPENSSL = os.path.join(PATH_BIN, 'openssl.exe')
|
|
PATH_XMLSEC = os.path.join(PATH_BIN, 'xmlsec.exe')
|
|
|
|
|
|
PRE = {
|
|
'2.0': '{http://www.sat.gob.mx/cfd/2}',
|
|
'2.2': '{http://www.sat.gob.mx/cfd/2}',
|
|
'3.0': '{http://www.sat.gob.mx/cfd/3}',
|
|
'3.2': '{http://www.sat.gob.mx/cfd/3}',
|
|
'3.3': '{http://www.sat.gob.mx/cfd/3}',
|
|
'TIMBRE': '{http://www.sat.gob.mx/TimbreFiscalDigital}',
|
|
'NOMINA': {
|
|
'1.1': '{http://www.sat.gob.mx/nomina}',
|
|
'1.2': '{http://www.sat.gob.mx/nomina12}',
|
|
}
|
|
}
|
|
|
|
CURRENT_CFDI = '3.3'
|