我正在使用 django 1.7 。我正在练习 Harry Percival 的 TDD with python 书。我正在关注这本书,但在某个地方出现了意外错误
NameError: name 'StaticLiveServerCase' is not defined
我正在寻找它,但我没有得到任何东西,有人可以告诉我这件事吗?该书第8章第131页。
最佳答案
类的名称应该是 StaticLiveServerTestCase
。 It is renamed just before the 1.7 release.
我认为这本书是基于 Django 1.7 的测试版。
更新
确保导入它:
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
关于python - 名称错误 : name 'StaticLiveServerCase' is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26238443/