阅读文档 ImportError

Read The Docs ImportError

找了半天没找到合适的方法。我总是犯错。 我已经尝试了下面列出的所有路径。

os.path.abspath sys.path.insert(0,
os.path.dirname(os.path.dirname(os.path.abspath("."))))
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, os.path.dirname(os.path.abspath('.')))
sys.path.insert(0, os.path.abspath('.')) 
sys.path.insert(0, os.path.abspath('..'))

这是 ReadTheDocs 错误输出

Running Sphinx v1.6.5
making output directory...

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/kh-taskbuster/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 305, in main
    opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/kh-taskbuster/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 168, in __init__
    confoverrides or {}, self.tags)
  File "/home/docs/checkouts/readthedocs.org/user_builds/kh-taskbuster/envs/latest/local/lib/python2.7/site-packages/sphinx/config.py", line 150, in __init__
    execfile_(filename, config)
  File "/home/docs/checkouts/readthedocs.org/user_builds/kh-taskbuster/envs/latest/local/lib/python2.7/site-packages/sphinx/util/pycompat.py", line 150, in execfile_
    exec_(code, _globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/kh-taskbuster/envs/latest/local/lib/python2.7/site-packages/six.py", line 709, in exec_
    exec("""exec _code_ in _globs_, _locs_""")
  File "<string>", line 1, in <module>
  File "conf.py", line 23, in <module>
    from django.conf import settings
ImportError: No module named django.conf

Exception occurred:
  File "conf.py", line 23, in <module>
    from django.conf import settings
ImportError: No module named django.conf

这是我的 conf.py 第 1-19 行的评论

import os
import sys
sys.path.insert(0, os.path.abspath('.'))
from django.conf import settings
settings.configure()

这是我的项目三

这是因为您没有指定项目需求详细信息所需的需求文件的内容。

转到您的 readthedocs 项目页面,然后单击菜单顶部的 'admin' link。然后转到 'advanced settings' 页面。您将看到需求文件的文本框。在这里写 'requirements/base.txt' 或写你的需求文件的路径。

保存之前,转到页面底部,您会在此处看到 'Python Interpreter' 设置。 Select '... 3.x' 版本,如果你在你的 django 项目中使用 python 3。

然后保存并转到 readthedocs 项目的 'Overview' 部分。单击构建,然后在打开的页面中单击 'Triggered'。稍等一下……这是您成功构建的项目。