我使用了Plone实例文件夹的“bin /”目录中的“paster”命令来创建一个名为“MyApp”的plone app(来自模板) - 命令是:
(from instance's root folder):> ./bin/paster create -t plone_app
当被问到名字时,我给了它“MyApp”。我将其复制到“src /”文件夹并在“buildout.cfg”文件中注册并运行buildout。我有这个过程适用于其他具有不同名称的应用程序,但似乎这个特定的应用程序总是崩溃Plone。当我访问我的网站时,我得到的只是Zope(并且无法访问Plone)。有原因吗? “MyApp”是否是导致崩溃的其他东西的保留名称空间?
我还应该注意,名字“myapp”工作得很好......
答案 0 :(得分:3)
当我尝试该命令时,它会像这样启动:
$ paster create -t plone_app
Selected and implied templates:
ZopeSkel#nested_namespace A basic Python project with a nested namespace (2 dots in name)
ZopeSkel#plone_app A project for Plone products with a nested namespace (2 dots in name)
这意味着您应该选择一个带有两个点的名称,而不是MyApp,例如plone.app.mine。当您仅将MyApp作为项目名称时,它显然会创建一个包MyApp.plone.MyApp。
是的,如果贴纸(zopeskel)在这里发出错误会更好。
实际上,当我在这里填写MyApp并在Plone 4站点中使用它时,它确实启动了。因此,粘贴您获得的精确回溯可能会有所帮助。但最好的选择可能就是选择一个更好的名字。
Plone本身为某些包使用嵌套命名空间(如plone.app.locales)。对于你自己的项目,我会说它有点矫枉过正。而是尝试使用'paster create -t plone',它需要像my.app或clientname.theme这样的名称。
答案 1 :(得分:3)
值得注意的是(特别是与Maurits的回应有关),如果你使用'zopeskel'脚本而不是贴纸,就像这样:
bin/zopeskel plone_app MyApp
您将收到一条错误消息,告知您需要一个带有两个点的名称。这是使用'zopeskel'脚本而不是paster命令的主要原因之一。当你安装zopeskel时,你应该在bin / paster旁边有一个bin / zopeskel。使用它,您将获得更好的错误消息和内联帮助。
答案 2 :(得分:3)
适合我:
aclark@Alex-Clarks-MacBook-Pro:~/Developer/test-4.1/src/ > paster create -t plone_app MyApp
Selected and implied templates:
ZopeSkel#nested_namespace A basic Python project with a nested namespace (2 dots in name)
ZopeSkel#plone_app A project for Plone products with a nested namespace (2 dots in name)
Variables:
egg: MyApp
package: myapp
project: MyApp
Expert Mode? (What question mode would you like? (easy/expert/all)?) ['easy']:
Version (Version number for project) ['1.0']:
Description (One-line description of the project) ['']:
Creating template nested_namespace
Creating directory ./MyApp
Recursing into +namespace_package+
Creating ./MyApp/MyApp/
Recursing into +namespace_package2+
Creating ./MyApp/MyApp/plone/
Recursing into +package+
Creating ./MyApp/MyApp/plone/MyApp/
Copying __init__.py_tmpl to ./MyApp/MyApp/plone/MyApp/__init__.py
Copying __init__.py_tmpl to ./MyApp/MyApp/plone/__init__.py
Copying __init__.py_tmpl to ./MyApp/MyApp/__init__.py
Copying README.txt_tmpl to ./MyApp/README.txt
Recursing into docs
Creating ./MyApp/docs/
Copying HISTORY.txt_tmpl to ./MyApp/docs/HISTORY.txt
Copying setup.py_tmpl to ./MyApp/setup.py
Creating template plone_app
Recursing into +namespace_package+
Recursing into +namespace_package2+
Recursing into +package+
Replace 0 bytes with 86 bytes (0/0 lines changed; 3 lines added)
Copying __init__.py_tmpl to ./MyApp/MyApp/plone/MyApp/__init__.py
Copying configure.zcml_tmpl to ./MyApp/MyApp/plone/MyApp/configure.zcml
Copying tests.py_tmpl to ./MyApp/MyApp/plone/MyApp/tests.py
Copying version.txt_tmpl to ./MyApp/MyApp/plone/MyApp/version.txt
Recursing into docs
Copying INSTALL.txt_tmpl to ./MyApp/docs/INSTALL.txt
Copying LICENSE.GPL to ./MyApp/docs/LICENSE.GPL
Copying LICENSE.txt_tmpl to ./MyApp/docs/LICENSE.txt
Replace 890 bytes with 973 bytes (0/32 lines changed; 4 lines added)
Copying setup.py_tmpl to ./MyApp/setup.py
使用buildout:
aclark@Alex-Clarks-MacBook-Pro:~/Developer/test-4.1/ > cat buildout.cfg
[buildout]
extends = http://dist.aclark.net/build/plone/4.1.x/develop.cfg
develop = src/MyApp
[plone]
eggs +=
MyApp
显然这不是你期望的结果,paster创建了一个名为“MyApp.plone.MyApp”的三重嵌套命名空间包:-)
进一步说明:此应用程序不会出现在Plone中的附加组件中,除非您在MyApp / plone / MyApp / configure.zcml中添加GenericSetup配置文件,如下所示:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="MyApp.plone.MyApp">
<five:registerPackage package="." initialize=".initialize" />
<genericsetup:registerProfile
name="default"
title="MyApp"
directory="profiles/default"
description="MyApp"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
</configure>
然后你应该看到:
最后,非命名空间包没有“错误”,它们只是惯例(在平面命名空间包上有优点/缺点,反之亦然)。见:
获取“平面”命名空间Plone包的示例。