鹈鹕:"You need to specify a path containing the content"

Pelican: "You need to specify a path containing the content"

我在某种程度上一直在关注 quick start guide,但我遇到了 运行 问题。正如我看到其他人建议的那样,我通过 Homebrew 安装了 Python(我在 OS X 上),随后也安装了 pip。我也用了virtualenvs.

所以现在我有一个文件夹 virtualenvs 和一个包含我的项目的子文件夹 pelican(带有 bin、site、include、lib 和输出文件夹)。在站点文件夹(和一些子文件夹)中,内容文件夹所在,当前包含文件 keyboard-review.md。

尝试 运行 pelican content 时出现问题,因为我得到:

Traceback (most recent call last):
  File "/Users/myuser/virtualenvs/pelican/bin/pelican", line 11, in <module>
    sys.exit(main())
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/__init__.py", line 386, in main
    pelican, settings = get_instance(args)
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/__init__.py", line 372, in get_instance
    settings = read_settings(config_file, override=get_config(args))
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/settings.py", line 169, in read_settings
    parsed_settings = configure_settings(local_settings)
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/settings.py", line 203, in configure_settings
    raise Exception('You need to specify a path containing the content'
Exception: You need to specify a path containing the content (see pelican --help for more information)

我已经尝试搜索如何执行此操作,但我没有找到。感觉使用 pelican path 应该很简单,但我还没有让它工作。对新手有什么帮助吗?

如果你尝试 运行 pelican 像这样:

pelican ~/virtualenvs/pelican/site/content/

虽然在终端使用 python 时指定这样的文件是可行的,但是 python 程序在打开文件时不能使用 ~/ 符号,所以 pelican 只是简单地告诉你这是一个无效的文件路径。

要修复你只需要指定绝对路径:

pelican /Users/myuser/virtualenvs/pelican/site/content/