问题:
一个用到material包 的Django项目,在Windows上可以很流畅的运行,我用pip freeze 将项目迁移到了mac上,结果报错:
Invalid template library specified.
ImportError raised when trying to load
'material.admin.templatetags.material_admin':
cannot import name 'Layout'
Invalid template library specified.
ImportError raised when trying to load 'material.admin.templatetags.material_admin':
cannot import name 'Layout'
解决
Google了很久,但都没有找到好的解决方案
- 于是自己根据报错问题,找到出错的位置:material_admin.py
然后发现是Layout没有正确的导入。 - 打开windows电脑下同样的位置,定位到Layout文件夹下,发现是material包下的base.py文件,对比一下,两个果然有差别,一不做二不休,直接将windows下base.py文件内容直接移动到mac 下base.py中: