DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead

こんなwarningがログにでてたんですが、django.conf.urls.defaultsを使ってる箇所が見当たらない。

DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead

と思ったらdjango-debug-toolbarが使っていた。

debug_toolbar/urls.py

"""
URLpatterns for the debug toolbar.

These should not be loaded explicitly; the debug toolbar middleware will patch
this into the urlconf for the request.
"""
from django.conf.urls.defaults import *

_PREFIX = '__debug__'

urlpatterns = patterns('',
    url(r'^%s/m/(.*)$' % _PREFIX, 'debug_toolbar.views.debug_media'),
    url(r'^%s/sql_select/$' % _PREFIX, 'debug_toolbar.views.sql_select', name='sql_select'),
    url(r'^%s/sql_explain/$' % _PREFIX, 'debug_toolbar.views.sql_explain', name='sql_explain'),
    url(r'^%s/sql_profile/$' % _PREFIX, 'debug_toolbar.views.sql_profile', name='sql_profile'),
    url(r'^%s/template_source/$' % _PREFIX, 'debug_toolbar.views.template_source', name='template_source'),
)


githubで最新のコードだと修正されてたので、そっちを入れれば解消される。

"""
URLpatterns for the debug toolbar.

These should not be loaded explicitly; the debug toolbar middleware will patch
this into the urlconf for the request.
"""
try:
    from django.conf.urls import patterns, url
except ImportError: # django < 1.4
    from django.conf.urls.defaults import patterns, url

_PREFIX = '__debug__'

urlpatterns = patterns('debug_toolbar.views',
    url(r'^%s/sql_select/$' % _PREFIX, 'sql_select', name='sql_select'),
    url(r'^%s/sql_explain/$' % _PREFIX, 'sql_explain', name='sql_explain'),
    url(r'^%s/sql_profile/$' % _PREFIX, 'sql_profile', name='sql_profile'),
    url(r'^%s/template_source/$' % _PREFIX, 'template_source', name='template_source'),
)
pip install -e "git://github.com/django-debug-toolbar/django-debug-toolbar.git#egg=debug_toolbar"


参考 : django.conf.urls.defaults is deprecated - Google グループ