APIFlask中文文档检查报错

有大佬懂这个错误该怎么处理吗?之前完全没有接触过文档生成 :sob:

这个报错我似乎遇到过,但是有点忘记怎么解决的了。可以试试先把 docs 目录之外的文件也都同步过来,类似这个 PR Merge pull request #42 from apiflask/sync-1.2.0 · apiflask/docs-zh@9ee0644 · GitHub

在本地复现出来了

$ mkdocs build

INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /root/workspace/docs-zh/site
ERROR    -  mkdocstrings: Importing 'apiflask.APIFlask' failed, possible causes are:
            - an exception happened while importing
            - an element in the path does not exist
            Traceback (most recent call last):
              File "/root/workspace/docs-zh/venv/lib/python3.10/site-packages/pytkdocs/loader.py", line 264, in get_object_tree
                parent_module = importlib.import_module(parent_module_path)
              File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
                return _bootstrap._gcd_import(name[level:], package, level)
              File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
              File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
              File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
            ModuleNotFoundError: No module named 'apiflask'
            ...
            ImportError: Importing 'apiflask.APIFlask' failed, possible causes are:
            - an exception happened while importing
            - an element in the path does not exist
ERROR    -  Error reading page 'api/app.md':
ERROR    -  Could not collect 'apiflask.APIFlask'

Aborted with a BuildError!
$ pip list

asgiref                    3.6.0
astunparse                 1.6.3
attrs                      22.2.0
Authlib                    1.2.0
build                      0.9.0
...

应该是执行mkdocs build时,没有apiflask依赖导致的错误

但是netlify.toml里有pip install .,应该会在构建的时候本地安装apiflask才对

还是不知道怎么解决这个问题 :exploding_head:

把源码同步过去之后就过了。过了,但是不知道为什么过了 :smiling_face_with_tear:

哈哈,过了就好