#20396 closed Bug (worksforme)
using 'reverse' function produces django.conf.urls.defaults is deprecated
Reported by: | 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)
Change History (3)
comment:1 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Resolution: | invalid → 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 by , 12 years ago
Thank you very much.Setting the stacklevel=2 showed that an external module was responsible for it.
Sorry for wrong reporting.
I suspect that one of your app or some dependency does produce the warning. Add a
stacklevel=2
parameter towarnings.warn
indjango.conf.urls.defaults
and you will probably find out who's the culprit.Reopen if you can show that Django is at fault.