Search⌘ K
AI Features

Write the Code for the URLs

Understand how to create and organize URLs in a Django project and application using test-driven development. Learn to write code for project and app URLs, run tests to ensure they work correctly, and practice best URL management without immediate need for refactoring.

The URLs will be divided into two categories. We have the project and the application URLs. This lesson will cover the remaining steps involved in TDD.

The project and catalog URLs

Below is the complete code for the project and catalog URLs:

from django.urls import path

from .views import home

urlpatterns = [
    path('', home, name='home')
]
The URLs for the Django project and application

Let’s start with the project URL. This can be found by navigating to the tdd_django folder. Inside it, we see a urls.py file that Django gives us by default. This is where our project URLs will reside.

...