May 2018
Beginner to intermediate
282 pages
7h 58m
English
Many beginners find the regular expressions special characters such as ^ or $ used in Django's URL patterns to be challenging. Regular expressions are a mini-language in themselves. So a simpler syntax, largely based on Flask, has been accepted as the new and default way of specifying URL patterns.
Instead of using regular expressions, you can specify the URL path directly in the pattern within the path function (which has the same parameters as the earlier URL function). You can also capture named parts of the URL within angle brackets and optionally prefix its data type.
Some examples can explain this better. The following table compares the old and new syntax:
|
Old (regular expression pattern) |
New ( |
Read now
Unlock full access