我偷偷怀疑斯芬克斯不喜欢我的翻译课。当我尝试执行自动方法时:
.. 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 中导入翻译,也有类似的问题。当我尝试类似的东西时,我仍然遇到问题:
from translations.models import Translation as t
它能够导入,但 Translation 中的导入最终导致 Sphinx 返回相同的错误。
有问题的文档在这里: