我使用https://github.com/plone/plonedev.vagrant在 Windows 上设置了 Plone 4.3 开发环境。我一直在尝试为我的安装添加 Dexterity 支持,但遇到了问题。
我采取的步骤如下:
将 zopeskel.dexterity 和 plone.app.dexterity [relations, grok] 添加到我的 buildout.cfg 的 [eggs] 部分
将 ZopeSkel <= 2.99 添加到 buildout.cfg 的 [versions] 部分
我重新运行 buildout 并尝试在前台模式下启动服务器,但得到这个回溯:
vagrant@precise32:~$ ./runbin.sh plonectl fg
instance: Traceback (most recent call last):
File "/home/vagrant/Plone/zinstance/bin/instance", line 290, in <module>
import plone.recipe.zope2instance.ctl
File "/home/vagrant/Plone/buildout-cache/eggs/plone.recipe.zope2instance-4.2.9-py2.7.egg/plone/recipe/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 704, in subscribe
callback(dist)
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2262, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1847, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1817, in _handle_ns
loader.load_module(packageName); module.__path__ = path
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/__init__.py", line 2, in <module>
from zopeskel.basic_namespace import BasicNamespace
File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/basic_namespace.py", line 2, in <module>
from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar
File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/vars.py", line 2, in <module>
from paste.script.templates import var as base_var
ImportError: No module named script.templates
编辑:我忘了提到 buildout.cfg 扩展了 base.cfg,其中包含以下内容:
[zopeskel]
# installs paster and Zopeskel
recipe = zc.recipe.egg
eggs =
ZopeSkel
Paste
PasteDeploy
PasteScript
${buildout:eggs}
我刚刚尝试明确添加PasteScript
到 buildout.cfg 中的 [eggs] 部分。运行 buildout 并尝试启动服务器后,我得到了不同的回溯:
vagrant@precise32:~$ ./runbin.sh plonectl fg
instance: Traceback (most recent call last):
File "/home/vagrant/Plone/zinstance/bin/instance", line 291, in <module>
import plone.recipe.zope2instance.ctl
File "/home/vagrant/Plone/buildout-cache/eggs/plone.recipe.zope2instance-4.2.9-py2.7.egg/plone/recipe/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 704, in subscribe
callback(dist)
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2262, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1847, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1817, in _handle_ns
loader.load_module(packageName); module.__path__ = path
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/__init__.py", line 2, in <module>
from zopeskel.basic_namespace import BasicNamespace
File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/basic_namespace.py", line 2, in <module>
from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar
File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/vars.py", line 2, in <module>
from paste.script.templates import var as base_var
File "/vagrant/plone/src/hello.world/PasteScript-1.7.5-py2.7.egg/paste/script/templates.py", line 9, in <module>
from paste.util.template import paste_script_template_renderer
ImportError: No module named util.template
这是我的 Python 路径的问题吗?bin/zopepy
然后我跑了import paste;print paste.__file__
,输出是:
/vagrant/plone/src/hello.world/PasteScript-1.7.5-py2.7.egg/paste/__init__.pyc
Paste-1.7.5.1 egg 目录确实包含一个 paste/util/template.py 文件,但看起来解释器找不到它。