From the course: Learning Django

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implement URL patterns

Implement URL patterns

From the course: Learning Django

Start my 1-month free trial

Implement URL patterns

- [Instructor] Let's implement the URL patterns for our project. In a text editor, navigate to inner wisdompets folder and open the urls.py file. I'll start by removing this comment at the top of the file. For our next step we'll need to import our views module, so that we can reference those views in our patterns. We haven't defined any views yet, but our views will be defined in our adoptions app. So I'll use from adoptions import views. On line seven, we can see that our URL patterns have an entry for the built-in Django admin, which we'll leave alone so that it continues to work as normal. For our first custom pattern, I'll add a line after that and I'll call the path function with the path converter set to empty string. This will match a URL with an empty path, sometimes called a root URL. For this pattern, I want to dispatch to the the home function. So for my second argument, I'll use views.home, which is a…

Contents