Cannot read properties of undefined (reading ‘$isServer‘)
django框架中怎样配置Uncaught TypeError: Cannot read properties of undefined (reading ‘$isServer’)
背景
项目使用simpleui,在django开发环境中启动服务,当我访问admin页面时,在浏览器控制台出现了报错提示Uncaught TypeError: Cannot read properties of undefined (reading ‘$isServer’) ,
问题分析
,问题可能出在 simpleui 插件与 Django Admin 页面或其他前端框架(如 Vue.js 或 Nuxt.js)之间的冲突。具体来说,simpleui 插件可能在渲染页面时加载了一些 JavaScript,这些脚本可能与 $isServer 变量相关,导致了该错误。
解决方法:
1. 升级 simpleui 插件
 
simpleui 插件有可能存在已知的 bug,或不兼容某些特定版本的 Django 或其他插件。首先,确保你安装的是 simpleui 的最新版本:
pip install --upgrade django-simpleui
然后,清理并重新收集静态文件:
python manage.py collectstatic
如果这个问题是插件本身的 bug,更新到最新版本可能会修复。
