empresa-libre/source/app/settings.py

107 lines
2.9 KiB
Python
Raw Normal View History

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-10-30 19:47:26 -06:00
from conf import DEBUG, LOG_PATH
2017-06-27 15:43:02 -05:00
2017-10-22 14:53:07 -05:00
DEBUG = DEBUG
2017-11-02 17:12:44 -06:00
VERSION = '0.2.1'
2017-09-30 00:22:55 -05:00
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-10-24 00:03:07 -05:00
PATH_MEDIA = os.path.abspath(os.path.join(BASE_DIR, '..', 'docs'))
2017-06-27 15:43:02 -05:00
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-26 13:09:47 -05:00
IV = 'valores_iniciales.json'
INIT_VALUES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', IV))
2017-10-29 16:53:10 -06:00
CT = 'cancel_template.xml'
TEMPLATE_CANCEL = os.path.abspath(os.path.join(PATH_TEMPLATES, CT))
2017-10-26 13:09:47 -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}'
2017-10-22 15:13:35 -05:00
2017-06-27 15:43:02 -05:00
if DEBUG:
LOG_LEVEL = 'DEBUG'
StreamHandler(
sys.stdout,
level=LOG_LEVEL,
format_string=format_string).push_application()
else:
RotatingFileHandler(
LOG_PATH,
backup_count=10,
max_size=1073741824,
level=LOG_LEVEL,
format_string=format_string).push_application()
2017-10-22 15:13:35 -05:00
StreamHandler(
sys.stdout,
level=LOG_LEVEL,
format_string=format_string).push_application()
2017-06-27 15:43:02 -05:00
log = Logger(LOG_NAME)
2017-10-10 18:49:05 -05:00
PATH_XSLTPROC = 'xsltproc'
PATH_OPENSSL = 'openssl'
2017-10-29 16:53:10 -06:00
PATH_XMLSEC = 'xmlsec1'
2017-10-10 18:49:05 -05:00
if 'win' in sys.platform:
PATH_XSLTPROC = os.path.join(PATH_BIN, 'xsltproc.exe')
PATH_OPENSSL = os.path.join(PATH_BIN, 'openssl.exe')
2017-10-29 16:53:10 -06:00
PATH_XMLSEC = os.path.join(PATH_BIN, 'xmlsec.exe')
2017-10-15 02:30:55 -05:00
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}',
2017-11-25 20:26:15 -06:00
'DONATARIA': '{http://www.sat.gob.mx/donat}',
2017-10-15 02:30:55 -05:00
'NOMINA': {
'1.1': '{http://www.sat.gob.mx/nomina}',
'1.2': '{http://www.sat.gob.mx/nomina12}',
}
}
2017-10-25 19:46:13 -05:00
CURRENT_CFDI = '3.3'
2017-11-11 20:21:00 -06:00
DEFAULT_PASSWORD = 'blades3.3'
2017-11-14 20:04:01 -06:00
DECIMALES = 2
2017-11-15 00:12:55 -06:00
IMPUESTOS = {
'ISR': '001',
'IVA': '002',
'IEPS': '003',
'ISH': '000',
'INSPECCION DE OBRA': '000',
'ICIC': '000',
'CEDULAR': '000',
}
2017-11-15 19:29:51 -06:00
DEFAULT_SAT_PRODUCTO = '01010101'