報錯內(nèi)容如下
image.png
TypeError at /booktest/goodtest/add/
render() got an unexpected keyword argument 'renderer'
Request Method: GET
Request URL: http://127.0.0.1:8000/booktest/goodtest/add/
Django Version: 2.1.7
Exception Type: TypeError
Exception Value:
render() got an unexpected keyword argument 'renderer'
Exception Location: /Users/zhangbin/py_envs/CoderZB_First/lib/python3.7/site-packages/django/forms/boundfield.py in as_widget, line 93
Python Executable: /Users/zhangbin/py_envs/CoderZB_First/bin/python
Python Version: 3.7.1
Python Path:
['/Users/zhangbin/Desktop/bj15/test1',
'/Users/zhangbin/py_envs/CoderZB_First/lib/python37.zip',
'/Users/zhangbin/py_envs/CoderZB_First/lib/python3.7',
'/Users/zhangbin/py_envs/CoderZB_First/lib/python3.7/lib-dynload',
'/Users/zhangbin/anaconda3/lib/python3.7',
'/Users/zhangbin/py_envs/CoderZB_First/lib/python3.7/site-packages']
Server time: 星期日, 17 二月 2019 01:50:39 +0800
問題原因:這是配置的 虛擬環(huán)境中的boundfield.py文件有問題導致的娘扩。具體是93行代碼的問題候址。
解決辦法:
步驟一:終端輸入如下命令打開boundfield.py
文件
open /Users/zhangbin/py_envs/CoderZB_First/lib/python3.7/site-packages/django/forms/boundfield.py
步驟二:注釋掉renderer=self.form.renderer,
即可掺涛。
步驟三:刷新頁面巴席,頁面正常顯示
image.png