Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#20396 closed Bug (worksforme)

using 'reverse' function produces django.conf.urls.defaults is deprecated

Reported by: marc3@… Owned by: nobody
Component: Core (URLs) Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


from django.core.urlresolvers import reverse

print reverse('some view func.', args=[...])

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


Change History (3)

comment:1 Changed 5 years ago by Claude Paroz

Resolution: invalid
Status: newclosed

I suspect that one of your app or some dependency does produce the warning. Add a stacklevel=2 parameter to warnings.warn in django.conf.urls.defaults and you will probably find out who's the culprit.
Reopen if you can show that Django is at fault.

comment:2 Changed 5 years ago by anonymous

Resolution: invalidworksforme

This works here.

E.g., after activating the admin app in INSTALLED_APPS and uncommenting related lines in the root

$ PYTHONPATH=~/django/upstream ./ shell
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import django

In [2]: print django.VERSION
------> print(django.VERSION)
(1, 5, 0, 'final', 0)

In [3]: from django.core.urlresolvers import reverse

In [4]: print reverse('admin:index')
------> print(reverse('admin:index'))

In [5]:

Make sure you are actually using Django 1.5 and you've previoulsy completely removed any trace of older versions as described in the installation docs.

comment:3 Changed 5 years ago by marc3@…

Thank you very much.Setting the stacklevel=2 showed that an external module was responsible for it.
Sorry for wrong reporting.

Note: See TracTickets for help on using tickets.
Back to Top