2017-08-14 62 views
-1

這是我的views.pyDjango的錯誤:HttpResponse對象無效語法

from django.shortcuts import render 
from django.http import HttpResponse 

def index(request): 
    reutrn HttpResponse("<h1>This is a test</h1>") 

不管我做什麼,這句法錯誤總是顯示出來!

File "C:\Users\#24\Python Projects\Test\Packages\views.py", line 6 
reutrn HttpResponse("<h1>This is a test</h1>") 
       ^
SyntaxError: invalid syntax 

我看上去很難看,如果其他人有這個問題,但沒有骰子。 這是我第一次嘗試的Django

+1

有內'return'一個錯字,它應該是'return HttpResponse(「

這是一個測試

」)'而不是'reutrn HttpResponse(「

這是一個測試

」)' – nivas

+0

謝謝!我知道這會是一件簡單的事情! –

回答

1

有一個在該線路上的拼寫錯誤,你應該輸入的回報代替reutrn

reutrn HttpResponse("<h1>This is a test</h1>")