[PATCH] Move django-debug-toolbar to requirements-dev.txt

Andrew Donnellan andrew.donnellan at au1.ibm.com
Thu Aug 25 17:06:53 AEST 2016


On 25/08/16 16:43, Daniel Axtens wrote:
> Don't install django-debug-toolbar as part of test requirements,
> but as part of dev requirements. This means we can install a more

Not only *can* you install ddt 1.5, but you *do* install 1.5 :)

> recent version and not have to worry about conflicts with old
> versions of Django interfering.
>
> Signed-off-by: Daniel Axtens <dja at axtens.net>

Reviewed-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

> ---
>
> This is my suggestion at a better way to approach the
> sqlparse/django-debug-toolbar mess.
>
> ---
>  patchwork/settings/dev.py | 34 +++++++++++++++++++---------------
>  requirements-dev.txt      |  1 +
>  requirements-test.txt     |  2 +-
>  3 files changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
> index b78a0bfeb0c8..0411806d36dd 100644
> --- a/patchwork/settings/dev.py
> +++ b/patchwork/settings/dev.py
> @@ -66,21 +66,25 @@ PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
>  # django-debug-toolbar
>
>  if django.VERSION >= (1, 7):
> -    INSTALLED_APPS += [
> -        'debug_toolbar'
> -    ]
> -
> -    DEBUG_TOOLBAR_PATCH_SETTINGS = False
> -
> -    # This should go first in the middleware classes
> -    MIDDLEWARE_CLASSES = [
> -        'debug_toolbar.middleware.DebugToolbarMiddleware',
> -    ] + MIDDLEWARE_CLASSES
> -
> -    INTERNAL_IPS = [
> -        '127.0.0.1', '::1',
> -        '172.17.0.1'
> -    ]
> +    try:
> +        import debug_toolbar
> +        INSTALLED_APPS += [
> +            'debug_toolbar'
> +        ]
> +
> +        DEBUG_TOOLBAR_PATCH_SETTINGS = False
> +
> +        # This should go first in the middleware classes
> +        MIDDLEWARE_CLASSES = [
> +            'debug_toolbar.middleware.DebugToolbarMiddleware',
> +        ] + MIDDLEWARE_CLASSES
> +
> +        INTERNAL_IPS = [
> +            '127.0.0.1', '::1',
> +            '172.17.0.1'
> +        ]
> +    except:

except ImportError:

> +        pass
>
>
>  #
> diff --git a/requirements-dev.txt b/requirements-dev.txt
> index d44ebc697bed..947c8d32744e 100644
> --- a/requirements-dev.txt
> +++ b/requirements-dev.txt
> @@ -1,2 +1,3 @@
>  Django>=1.8,<1.10
> +django-debug-toolbar==1.5
>  -r requirements-test.txt
> diff --git a/requirements-test.txt b/requirements-test.txt
> index cfc242f647f8..89b466a4aca0 100644
> --- a/requirements-test.txt
> +++ b/requirements-test.txt
> @@ -1,6 +1,6 @@
>  mysqlclient==1.3.7  # replace this with psycopg2 for a PostgreSQL backend
> -django-debug-toolbar==1.4
>  python-dateutil>2.0,<3.0
>  selenium>2.0,<3.0
>  djangorestframework>=3.3,<3.4
>  drf-nested-routers>=0.11.1,<0.12
> +sqlparse

Should this be versioned?

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Patchwork mailing list