Join Caleb Smith for an in-depth discussion in this video Understanding URL patterns, part of Learning Python and Django (2015).
- Let's dig a bit deeper into URL patterns…which dispatch requests to views based on the path.…First, we'll take a brief look at regular expressions.…Regular expressions are used to interpret the URLs…for your site.…A regular expression is a sequence of characters…that defines a search pattern for strings.…Here are some examples for some regular expressions…that we'll use.…With the regular expression ducky,…this will match the word ducky anywhere found in the string.…With \d, this will match a single digit character.…This has nothing to do with the character d.…
d here stands for digit and the backslash means…it will be interpreted to mean any digit character.…\d+ means one or more digit characters…so this will match any number up until the point…in the string where it's no longer numbers.…So, in the string 12 ounces, this will match against…the characters 1 and 2.…The regular expression caret admin/…will match any string that begins with admin/…but will not match the word admin anywhere else…in the string.…Similarly, the $ means end of sequence.…
- Creating a new Django project
- Defining Django models and fields
- Querying data with the Django ORM
- Building views and templates
Skill Level Intermediate
Q: pip says it was installed correctly, and I've updated the PATH variable as shown, but the pip --version command isn't working. Why?
A: Depending on your computer's setup, you'll need to restart your terminal/command prompt before the additions you've made to the PATH variable are respected. With some setups, even that won't be enough, and you may need to restart the entire machine before you are able to use the pip command directly.