Code

Opened 11 months ago

Closed 11 months ago

Last modified 11 months 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

Description

from django.core.urlresolvers import reverse

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

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

DeprecationWarning)

Attachments (0)

Change History (3)

comment:1 Changed 11 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 11 months ago by anonymous

  • Resolution changed from invalid to worksforme

This works here.

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

$ PYTHONPATH=~/django/upstream ./manage.py 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'))
/admin/

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 11 months ago by marc3@…

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.