我正在使用 django 1.7 。我正在用 python 书练习 Harry Percival 的 TDD。我正在关注这本书,但在某个地方出现了意想不到的错误
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
