2017-04-04 72 views

回答

0

我不知道是什么runAreaReview(param)应该返回,但假设它会返回的字符串,例如,那么这应该工作:

from django.http import HttpResponse 

def result(request): 
    param = ... 
    this = ...' 
    return HttpResponse(this) 
1

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.

在你的代码中,你只是返回一个值而不是HttpResponse。正确的代码将是:

from django.http import HttpResponse 
def result(request): 
    if request=="POST": 
     return HttpResponse("something you want to view") 
+0

我将代码更改为“返回HttpResponse”,但我仍然收到错误。 –

+0

对于测试:我加 返回HttpResponse(“测试”) 但现在抛出的错误是:AttributeError:'NoneType'对象没有属性'split –

+0

哪个django版本你当前在你的项目中使用? – orvi