Adding Route In Django

[Solved] Adding Route In Django | Python Frameworks Django - Code Explorer | www.yomemimo.com
Question : Adding Route In Django

Answered by : eric-tam

urls.py
from django.urls import path
from . import views
urlpatterns = [ path('', views.index, name='index'), path("second", views.second, name="index")
]
views.py
def index(request): return HttpResponse("Hello, world. You're at the polls index.")
def second(request): return HttpResponse("Second line of code that I added")

Source : | Last Update : Wed, 20 Jul 22

Answers related to Adding Route In Django

Code Explorer Popular Question For Python Frameworks Django