зеркало из https://github.com/mozilla/treeherder.git
Bug 1216113 - Enable django debug toolbar in vagrant
This commit is contained in:
Родитель
82373329ca
Коммит
cf39f8b530
|
@ -67,6 +67,16 @@ Or for more control, run each tool individually:
|
|||
|
||||
.. _managing-api-credentials:
|
||||
|
||||
Profiling API endpoint performance
|
||||
----------------------------------
|
||||
|
||||
On our development (vagrant) instance we have `django-debug-toolbar
|
||||
<http://django-debug-toolbar.readthedocs.io/>`_ installed, which can give
|
||||
information on exactly what SQL is run to generate individual API
|
||||
endpoints. Just navigate to an endpoint
|
||||
(example: http://local.treeherder.mozilla.org/api/repository/) and
|
||||
you should see the toolbar to your right.
|
||||
|
||||
Managing API credentials
|
||||
------------------------
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
LOCAL_APPS = ['debug_toolbar']
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': True,
|
||||
|
|
|
@ -9,6 +9,7 @@ class dev{
|
|||
exec{"migrate":
|
||||
cwd => "${PROJ_DIR}",
|
||||
command => "bash -c 'source /etc/profile.d/treeherder.sh; ${VENV_DIR}/bin/python manage.py migrate --noinput'",
|
||||
require => Exec["pip-install-dev"],
|
||||
user => "${APP_USER}",
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ export DATABASE_URL='mysql://${DB_USER}:${DB_PASS}@localhost/treeherder'
|
|||
export DATABASE_URL_RO='mysql://${DB_USER}:${DB_PASS}@localhost/treeherder'
|
||||
export BROKER_URL='amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@localhost:5672/${RABBITMQ_VHOST}'
|
||||
export TREEHERDER_DEBUG='True'
|
||||
export ENABLE_DEBUG_TOOLBAR='True'
|
||||
export TREEHERDER_DJANGO_SECRET_KEY='${DJANGO_SECRET_KEY}'
|
||||
export NEW_RELIC_DEVELOPER_MODE='True'
|
||||
"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
pytest==2.9.0 --hash=sha256:8429b6803ca95ad179ad2db53233c42aec0323279347bb6bdc652bba4e2bfb49
|
||||
|
||||
django-debug-toolbar==1.4 --hash=sha256:852a37b80df9597048591ebc87d0ce85a4edceaef015dc5360ad89cc5960c27b
|
||||
|
||||
datadiff==2.0.0 --hash=sha256:54049440a896de5247ee2e7b7aa5425f939ac832c37edb2101f8d3036e89caa8
|
||||
|
||||
WebTest==2.0.20 --hash=sha256:e5321e72831aee8e6038a62238785b2d6098233d58fb11f715614c9d6d3d7fda
|
||||
|
|
|
@ -12,6 +12,8 @@ TREEHERDER_MEMCACHED = env("TREEHERDER_MEMCACHED", default="127.0.0.1:11211")
|
|||
TREEHERDER_MEMCACHED_KEY_PREFIX = env("TREEHERDER_MEMCACHED_KEY_PREFIX", default="treeherder")
|
||||
|
||||
DEBUG = env.bool("TREEHERDER_DEBUG", default=False)
|
||||
ENABLE_DEBUG_TOOLBAR = env.bool("ENABLE_DEBUG_TOOLBAR", False)
|
||||
DEBUG_TOOLBAR_PATCH_SETTINGS = False # disable django debug toolbar automatic configuration
|
||||
|
||||
TREEHERDER_REQUEST_PROTOCOL = env("TREEHERDER_REQUEST_PROTOCOL", default="http")
|
||||
TREEHERDER_REQUEST_HOST = env("TREEHERDER_REQUEST_HOST", default="local.treeherder.mozilla.org")
|
||||
|
@ -70,13 +72,14 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||
'django.contrib.messages.context_processors.messages'
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
MIDDLEWARE_CLASSES = [middleware for middleware in [
|
||||
# Redirect to HTTPS/set HSTS and other security headers.
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
# Allows both Django static files and those specified via `WHITENOISE_ROOT`
|
||||
# to be served by WhiteNoise, avoiding the need for Apache/nginx on Heroku.
|
||||
'treeherder.config.whitenoise_custom.CustomWhiteNoise',
|
||||
'django.middleware.gzip.GZipMiddleware',
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware' if ENABLE_DEBUG_TOOLBAR else False,
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
|
@ -86,7 +89,11 @@ MIDDLEWARE_CLASSES = [
|
|||
'hawkrest.middleware.HawkResponseMiddleware',
|
||||
# Uncomment the next line for simple clickjacking protection:
|
||||
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
] if middleware]
|
||||
|
||||
if ENABLE_DEBUG_TOOLBAR:
|
||||
# set INTERNAL_IPS if debug enabled, so the toolbar works
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from django.conf import settings
|
||||
from django.conf.urls import (include,
|
||||
url)
|
||||
from django.contrib import admin
|
||||
|
@ -19,3 +20,9 @@ urlpatterns = [
|
|||
url(r'^credentials/', include(credentials_patterns)),
|
||||
url(r'', include('django_browserid.urls')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
import debug_toolbar
|
||||
urlpatterns += [
|
||||
url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче