Saturday, October 25, 2014

Re: New way to use URL dispatchers?


On Oct 24, 2014, at 8:37 PM, Russell Keith-Magee <russell@keith-magee.com> wrote:

When it is released, Django 1.8 will include support for the new preferred format for URLpatterns. Django 1.7 doesn't support this new format, and the documentation for version 1.7:


doesn't mention the new format. 

Small clarification: the "new" way (urlpatterns just a list of urls) actually works just fine in 1.7, 1.6, and earlier versions of Django too (as long as you use the `url(…)` function to define each url, and import your views rather than referencing them as strings). So you can switch to it right now, regardless of what Django version you are using.

The 1.7 docs still use the `patterns(…)` function (which is deprecated starting in 1.8) simply in order to maintain compatibility with the output of 1.7's startproject command.

Carl

No comments:

Post a Comment