django: return string from view

According to the documentation:

A view function, or view for short, is simply a Python function that
takes a Web request and returns a Web response.

Each view function is responsible for returning an HttpResponse
object.

In other words, your view should return a HttpResponse instance:

from django.http import HttpResponse

def myview(request):
    return HttpResponse("return this string")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)