From ef8964284c0034ce61d1d087be9f86a9fc5a4d6e Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Thu, 7 Jan 2016 15:39:36 +0000 Subject: [PATCH 1/3] Integrated logging from the utils repo --- app/__init__.py | 2 ++ requirements.txt | 2 ++ scripts/run_app.sh | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/__init__.py b/app/__init__.py index 498230fe3..51cfbb27b 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -12,6 +12,7 @@ from app.notify_client.api_client import AdminAPIClient from app.its_dangerous_session import ItsdangerousSessionInterface import app.proxy_fix from config import configs +from utils import logging db = SQLAlchemy() @@ -31,6 +32,7 @@ def create_app(config_name): db.init_app(application) init_app(application) init_csrf(application) + logging.init_app(application) login_manager.init_app(application) login_manager.login_view = 'main.render_sign_in' diff --git a/requirements.txt b/requirements.txt index 42b66ee5a..1c6175044 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,5 @@ Flask-Login==0.2.11 Flask-Bcrypt==0.6.2 git+https://github.com/alphagov/notify-api-client.git@0.1.4#egg=notify-api-client==0.1.4 + +git+https://github.com/alphagov/notifications-utils.git@0.0.3#egg=notifications-utils==0.0.3 diff --git a/scripts/run_app.sh b/scripts/run_app.sh index a5ec9d8b5..96947cc19 100755 --- a/scripts/run_app.sh +++ b/scripts/run_app.sh @@ -1,3 +1,3 @@ #!/bin/bash -python app.py runserver +python3 app.py runserver From 55534522e090fb41fbcee608a3bc6656f5806d28 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Thu, 7 Jan 2016 15:42:16 +0000 Subject: [PATCH 2/3] updated config with logging properties --- config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.py b/config.py index 8a9e5745a..4dade6412 100644 --- a/config.py +++ b/config.py @@ -7,6 +7,10 @@ class Config(object): cache = False manifest = True + NOTIFY_LOG_LEVEL = 'DEBUG' + NOTIFY_APP_NAME = 'api' + NOTIFY_LOG_PATH = '/var/log/notify/application.log' + SQLALCHEMY_COMMIT_ON_TEARDOWN = False SQLALCHEMY_RECORD_QUERIES = True SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/notifications_admin' From 684230370fb4cb4fe5426480b3efd222957333cb Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Thu, 7 Jan 2016 15:52:56 +0000 Subject: [PATCH 3/3] Tests run in debug mode --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 4dade6412..997c9182d 100644 --- a/config.py +++ b/config.py @@ -36,7 +36,7 @@ class Development(Config): class Test(Config): - DEBUG = False + DEBUG = True SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/test_notifications_admin' WTF_CSRF_ENABLED = False