gpt4 book ai didi

python - 名称错误 : name 'StaticLiveServerCase' is not defined

转载 作者:太空宇宙 更新时间:2023-11-04 03:41:24 24 4
gpt4 key购买 nike

我正在使用 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

关于python - 名称错误 : name 'StaticLiveServerCase' is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26238443/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com