Vladyslav
Vladyslav

Reputation: 2265

What is the "path" mean in Django urls

When a read some new project on Django in one of urls.py files i find following code:

from django.urls import path
from . import views

urlpatterns = [
    path('buyers/embed/<int:id>/view', views.buyers_view),
]

This is written in application that not used for now (Instead of this is used another application for buyers view). But i want to know what is this path.

I can't find any information about it in documentation. Maybe this is some old style for url routing, or some mistakes.

Thanks for any help.

Upvotes: 5

Views: 13115

Answers (2)

omar ahmed
omar ahmed

Reputation: 663

path() Function Returns an element for inclusion in urlpatterns with 4 args: Two required route and view and two are optional kwargs and name

path(route, view, kwargs=None, name=None)

Upvotes: 1

Alasdair
Alasdair

Reputation: 309089

path() is from the new URL syntax, which was added in Django 2.0.

You can find out more information in the tutorial or url docs, as long as you have Django 2.0 or later selected on the documentation site.

Upvotes: 9

Related Questions