[Answer]-Django – "urls" function sometime included in urls.py

1πŸ‘

βœ…

The use of patterns() makes the use of url() optional. Going forward, however, patterns will be deprecated and you will have to always use url. See this ticket:

The other thing that patterns provides besides the prefix parameter is automatically wrapping plain tuples in urlpatterns in url(). I think removing this and forcing usage of url() will be a good cleanup.

So you should get in the habit of always using url.

0πŸ‘

Thank you for clarification with your edit:

  • First one points to the view
  • second one allows you to add another patterns list from separate module (or from the same one)

But usage of url is purely for convenience (but will be required in django 2.0). You can see the check here:

https://github.com/django/django/blob/master/django/conf/urls/init.py#L55

Leave a comment