Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære URL Configuration | The First Application
Django: Build Your First Website

bookURL Configuration

How to do URL distribution?

Step 1. Create the URLs file in App.
Find the connected app folder and create the urls.py file:

Step 2. Include app URLs to the main core of project.
Open the urls.py file in the main core of project (in our case, the main folder):

Now we need to add our app to the urlpatterns list using the path() and include() functions.

I recommend replacing the existing code in your file with the example code below.

from django.contrib import admin
from django.urls import include, path
    
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('notes.urls'))
]

The provided code sets up a URL pattern for the Django project. It defines a URL pattern with the path '' that includes the URLs from the 'notes.urls' module. The include() function is used to include the URL patterns from the 'notes.urls' module. This configuration allows requests with the path starting with '' to be handled by the URLs defined in the 'notes.urls'.

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 2. Kapitel 3

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Awesome!

Completion rate improved to 4

bookURL Configuration

Stryg for at vise menuen

How to do URL distribution?

Step 1. Create the URLs file in App.
Find the connected app folder and create the urls.py file:

Step 2. Include app URLs to the main core of project.
Open the urls.py file in the main core of project (in our case, the main folder):

Now we need to add our app to the urlpatterns list using the path() and include() functions.

I recommend replacing the existing code in your file with the example code below.

from django.contrib import admin
from django.urls import include, path
    
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('notes.urls'))
]

The provided code sets up a URL pattern for the Django project. It defines a URL pattern with the path '' that includes the URLs from the 'notes.urls' module. The include() function is used to include the URL patterns from the 'notes.urls' module. This configuration allows requests with the path starting with '' to be handled by the URLs defined in the 'notes.urls'.

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 2. Kapitel 3
some-alt