2
現在、Gitを通じてローカルに展開されたAzureでDjango Webアプリケーションを設定しています。私は実際にはまだコードを書いていない、と私は/render()でDjango TypeErrorが予期しないキーワード引数 'context_instance'を受け取りました
python3 manage.py runserver
を使用して、開発サーバを起動して、サイトのアドレスに行くとき、私は次のエラーを取得する:
TypeError at/
render() got an unexpected keyword argument 'context_instance'
これは、ビューにトレースされます。
"""
Definition of views.
"""
from django.shortcuts import render
from django.http import HttpRequest
from django.template import RequestContext
from datetime import datetime
def home(request):
"""Renders the home page."""
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
context_instance = RequestContext(request,
{
'title':'Home Page',
'year':datetime.now().year,
})
)
def contact(request):
"""Renders the contact page."""
assert isinstance(request, HttpRequest)
return render(
request,
'app/contact.html',
context_instance = RequestContext(request,
{
'title':'Contact',
'message':'Your contact page.',
'year':datetime.now().year,
})
)
def about(request):
"""Renders the about page."""
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
context_instance = RequestContext(request,
{
'title':'About',
'message':'Your application description page.',
'year':datetime.now().year,
})
)
私はエラーがアプリがAzureの中で作成されたときにコードが生成されて以来、何であるかわからないんだけど、次の内容を持っている、PY。私がドキュメントから見る限り、render()のパラメータは正しいです。