Python Django render得到一个意外的关键字参数';上下文实例';

Python Django render得到一个意外的关键字参数';上下文实例';,python,django,pycharm,Python,Django,Pycharm,我使用的是Python 3.6,我想在PyCharm中使用Django框架运行一个项目,但我遇到了以下错误: TypeError at / render() got an unexpected keyword argument 'context_instance' Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 2.1.7 Exception Type: TypeError Exception

我使用的是Python 3.6,我想在PyCharm中使用Django框架运行一个项目,但我遇到了以下错误:

TypeError at /
render() got an unexpected keyword argument 'context_instance'
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 2.1.7
Exception Type: TypeError
Exception Value:    
render() got an unexpected keyword argument 'context_instance'
Exception Location: C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\xaon\app\views.py in home, line 16
Python Executable:  C:\Users\hp\AppData\Local\Programs\Python\Python36\dj\f\Scripts\python.exe
Python Version: 3.6.5
Python Path:    
['C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\xaon',
 'C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\f\\Scripts\\python36.zip',
 'C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\f\\DLLs',
 'C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\f\\lib',
 'C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\f\\Scripts',
 'c:\\users\\hp\\appdata\\local\\programs\\python\\python36\\Lib',
 'c:\\users\\hp\\appdata\\local\\programs\\python\\python36\\DLLs',
 'C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\f',
 'C:\\Users\\hp\\AppData\\Local\\Programs\\Python\\Python36\\dj\\f\\lib\\site-packages']
Server time:    Thu, 28 Mar 2019 22:20:33 +0000 
我的
view.py
如下所示:

def home(request): 
    assert isinstance(request, HttpRequest)
    return render(
        request, 
        'app/index.html', 
        context_instance=RequestContext(request, { 'title':'Home Page', })
        ) 

您使用的是Django 2.1.7,但是在Django 2.0中,
context\u实例
positional参数被删除。您只需调用
render()
快捷方式函数即可


有关
context\u实例的更多信息,请参见。

Hi,欢迎使用堆栈溢出。xaon\app\views.py第16行有问题。你能给我们看一下这个文件吗?def home(request):assert isinstance(request,HttpRequest)return render(request,'app/index.html',context_instance=RequestContext(request,{'title':'homepage',})第16行是:{'title':'homepage',}下一次,编辑你的问题比将代码放在评论中要好。那里看起来有点拥挤吗?;)好的,如果你需要帮助,将代码以图片的形式发布不是一个好主意。任何想回答你问题的人都希望复制并粘贴你的代码,或者至少在没有链接的情况下看到它。我建议你阅读在你问下一个问题之前,你会发现遵守这些规则会让你的问题更有可能找到答案!祝你好运!