Fix problems with customized HorizonMiddleware on development server.
Change-Id: I8c8bd9649724f37ed184b9e3ff57d48e85ca4f92
This commit is contained in:
parent
5df8ceff59
commit
108b703476
|
@ -0,0 +1,26 @@
|
|||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from horizon.middleware import HorizonMiddleware
|
||||
import traceback
|
||||
import logging
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ExceptionMiddleware(HorizonMiddleware):
|
||||
def process_exception(self, request, exception):
|
||||
logger.error(traceback.format_exc())
|
||||
return super(ExceptionMiddleware, self).process_exception(
|
||||
request, exception)
|
|
@ -1,11 +1,8 @@
|
|||
import logging
|
||||
import traceback
|
||||
import os
|
||||
import sys
|
||||
from django.http import HttpResponseServerError
|
||||
from openstack_dashboard import exceptions
|
||||
from muranoclient.common import exceptions as muranoclient
|
||||
from horizon.middleware import HorizonMiddleware
|
||||
|
||||
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
BIN_DIR = os.path.abspath(os.path.join(ROOT_PATH, '..', 'bin'))
|
||||
|
@ -67,16 +64,6 @@ HORIZON_CONFIG = {
|
|||
}
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ExceptionMiddleware(HorizonMiddleware):
|
||||
def process_exception(self, request, exception):
|
||||
logger.error(traceback.format_exc())
|
||||
return super(ExceptionMiddleware, self).process_exception(
|
||||
request, exception)
|
||||
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
|
|
|
@ -117,7 +117,7 @@ HORIZON_CONFIG['exceptions']['not_found'] = EXTENDED_NOT_FOUND_EXCEPTIONS
|
|||
HORIZON_CONFIG['exceptions']['unauthorized'] = EXTENDED_UNAUTHORIZED_EXCEPTIONS
|
||||
HORIZON_CONFIG['customization_module'] = 'muranodashboard.panel.overrides'
|
||||
INSTALLED_APPS += ('muranodashboard','floppyforms',)
|
||||
MIDDLEWARE_CLASSES += ('muranodashboard.settings.ExceptionMiddleware',)
|
||||
MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
|
||||
LOGGING['formatters'] = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
|
||||
LOGGING['handlers']['file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '/var/log/murano-dashboard.log'}
|
||||
LOGGING['loggers']['muranodashboard'] = {'handlers': ['file'], 'level': 'DEBUG'}
|
||||
|
|
2
setup.sh
2
setup.sh
|
@ -98,7 +98,7 @@ HORIZON_CONFIG['exceptions']['not_found'] = EXTENDED_NOT_FOUND_EXCEPTIONS
|
|||
HORIZON_CONFIG['exceptions']['unauthorized'] = EXTENDED_UNAUTHORIZED_EXCEPTIONS
|
||||
HORIZON_CONFIG['customization_module'] = 'muranodashboard.panel.overrides'
|
||||
INSTALLED_APPS += ('muranodashboard','floppyforms',)
|
||||
MIDDLEWARE_CLASSES += ('muranodashboard.settings.ExceptionMiddleware',)
|
||||
MIDDLEWARE_CLASSES += ('muranodashboard.middleware.ExceptionMiddleware',)
|
||||
LOGGING['formatters'] = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
|
||||
LOGGING['handlers']['file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '/var/log/murano-dashboard.log'}
|
||||
LOGGING['loggers']['muranodashboard'] = {'handlers': ['file'], 'level': 'DEBUG'}
|
||||
|
|
Loading…
Reference in New Issue