我暗暗怀疑 Sphinx 不喜欢我的翻译课。当我尝试执行自动方法时:
.. automethod:: translations.models.Translation.new
我收到这个警告:
/Users/dash/Projects/zamboni/zamboni/docs/topics/translations.rst:39:
(WARNING/2) autodoc can't import/find method
'translations.models.Translation.new', it reported error: "cannot import name
Translation", please check your spelling and sys.path
路径等等都是正确的。我试过直接在 conf.py 中导入 Translation,但遇到了类似的问题。当我尝试类似的操作时仍然遇到问题:
from translations.models import Translation as t
它能够导入,但 Translation 中的导入最终导致 Sphinx 返回相同的错误。
有问题的文档在这里:
请您参考如下方法:
查看 Zamboni 源代码,也许您应该这样做:
.. automethod:: apps.translations.models.Translation.new
?
