django.conf.urls.defaults is deprecated

5,756 views
Skip to first unread message

Thiago Carvalho D' Ávila

unread,
Jan 6, 2013, 9:57:25 AM1/6/13
to Django Users
Hello,

I am having this "DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead" when I runserver.. but there is no reference to django.conf.urls.defaults. Any hint of what should I do to take it off?

Thanks.

nkryptic

unread,
Jan 6, 2013, 10:36:15 AM1/6/13
to django...@googlegroups.com
In your urls.py file, you probably have something like:
from django.conf.urls.defaults import patterns, url, include

change that to:
from django.conf.urls import patterns, url, include

Thiago Carvalho D' Ávila

unread,
Jan 7, 2013, 1:13:33 PM1/7/13
to django...@googlegroups.com
Nope. If I grep my entire project folder with: grep "defaults" . -r, the only result is:
Binary file ./settings.pyc matches

Then I delete it, and runserver again, I get the message:
/virtualenvs/env-hrp-rc/local/lib/python2.7/site-packages/django/conf/urls/defaults.py:3: DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead
  DeprecationWarning)

And the compiled settings.py continue to match =(

2013/1/6 nkryptic <nkry...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/PfNMQ3NFctYJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Timster

unread,
Jan 7, 2013, 1:19:24 PM1/7/13
to django...@googlegroups.com
Are you including any other apps that are not located under your project folder?

Bill Freeman

unread,
Jan 7, 2013, 1:23:53 PM1/7/13
to django...@googlegroups.com
This could be happening in some app that you have pip installed (or equivalent) and
are using in installed apps, or which is being included by some app that is.

You could find-grep in your virtualenv's site-packages for 'default' and pass the result
into grep 'urls', and if necessary, into  grep 'conf'.

Another approach is to stick in a set_trace() where the warning is getting triggered or
(since this is presumably your only deprecation warning) where it is getting printed,
and 'u' your way up the stack to see who's importing it, and, if necessary, what they
are being imported, etc.

Having found the source, you could then:
  See if there is a newer version with it fixed
  Patch it yourself (and submit the patch to the maintainer)
  Or live with it -- for now it's only a deprecation warning.  You will have to find it if you
     upgrade Django to the point that it fails.

Bill

nkryptic

unread,
Jan 7, 2013, 1:34:45 PM1/7/13
to django...@googlegroups.com
You could try running:

$ python -W error manage.py runserver

That should cause the deprecation warning to actually raise an error and cause a traceback to be displayed and hopefully show you where that import is happening.

Thiago Carvalho D' Ávila

unread,
Jan 7, 2013, 4:40:36 PM1/7/13
to django...@googlegroups.com
Thanks Bill, solved my puzzle. Reversion and debug-toolbar's latest version are using old import.

And nkryptic, I tryed that, but the DepracationWarnings simply doens't turn into errors with this command here =/

2013/1/7 nkryptic <nkry...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/n9o4WM8mPEUJ.
Reply all
Reply to author
Forward
0 new messages