A
A
ahmed_al_asad2016-09-28 20:30:04
Django
ahmed_al_asad, 2016-09-28 20:30:04

How to show the site itself in the view?

Let's say there is a function that returns text with the word "Test":

def index(request):
    return HttpResponse("<h1>Тест</h1>")

Its URL is written like this:
from django.conf.urls import url
from django.contrib import admin
from shop import views

urlpatterns = [
    url(r'^test/', views.index),
]

Now the question is how to return the site view itself in the def index (request) function? I will not push the weight of the site's html into the def index (request) function.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Kuts, 2016-09-28
@fox_12

Read for templates

T
tema_sun, 2016-09-28
@tema_sun

You should not return html code in the view in any way at all.
Judging by the question, I can only recommend reading the documentation further.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question