Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Render Django Template

views.py
def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")
def hello(request):
   return render(request, 'hello.html', {})
   
urls.py
from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path('hello', views.hello, name="index")
] 

templates/hello.html
<b>fdsfdsfldsjflkdsjkflksja;fdsfdsfldsjflkdsjkflksjasdfkldsjflkdsjfds</b>
<b>>fdlksjfdsljfldsjflkds</b>

Source by docs.djangoproject.com #
 
PREVIOUS NEXT
Tagged: #Render #Django #Template
ADD COMMENT
Topic
Name
4+8 =