From 04fda8b9a23f56a3ffdea8d139ac2fb5eb69b565 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Thu, 11 Jan 2018 10:20:55 -0600 Subject: [PATCH] Cambio de rutas en cache de sesiones --- .gitignore | 3 ++- source/app/main.py | 8 +++++--- source/app/settings.py | 6 ++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e6db0be..afaf04f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,9 +12,10 @@ source/fixtures source/media # Sphinx documentation -docs/ *.xlsx +docs/ +cache/ credenciales.conf *.sqlite *.sql diff --git a/source/app/main.py b/source/app/main.py index e25c859..50ce137 100644 --- a/source/app/main.py +++ b/source/app/main.py @@ -20,6 +20,9 @@ from controllers.main import (AppEmpresas, ) +from settings import PATH_SESSIONS + + db = StorageEngine() api = falcon.API(middleware=[ @@ -54,13 +57,12 @@ api.add_route('/movbanco', AppMovimientosBanco(db)) # ~ Activa si usas waitress y NO estas usando servidor web # ~ api.add_sink(static, '/static') - session_options = { 'session.type': 'file', 'session.cookie_expires': True, 'session.httponly': True, - 'session.data_dir': '/tmp/cache/data', - 'session.lock_dir': '/tmp/cache/lock', + 'session.data_dir': PATH_SESSIONS['data'], + 'session.lock_dir': PATH_SESSIONS['lock'], } app = SessionMiddleware(api, session_options) diff --git a/source/app/settings.py b/source/app/settings.py index 8c4d106..6532756 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -25,6 +25,7 @@ VERSION = '1.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')) @@ -33,6 +34,11 @@ 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')) +PATH_SESSIONS = { + 'data': os.path.abspath(os.path.join(BASE_DIR, '..', 'cache', 'data')), + 'lock': os.path.abspath(os.path.join(BASE_DIR, '..', 'cache', 'lock')), +} + IV = 'valores_iniciales.json' INIT_VALUES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', IV)) CT = 'cancel_template.xml'