Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Adding Route In Django

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")
 
PREVIOUS NEXT
Tagged: #Adding #Route #In #Django
ADD COMMENT
Topic
Name
7+4 =