在virtualenv中运行blone的工具
isotoma.plone.heroku的Python项目详细描述
扑向英雄
**警告**当前plone包含语法错误(外观无效 Python,那我们为什么要打电话呢。py!!)Heroku真的不喜欢这样。 目前你不能在第一次成功扑救后再次部署 因为它的部署。我已经报告过了。
您需要
- The heroku tools installed locally and working
- A verified heroku account
- A willingness to spend $15 a month for 20GB of Postgres (Plone doesnt fit in 5mb).
启动项目
我们需要能够在virtualenv中安装plone,并且不需要任何 构建的环境构建能力。除此之外,运行时 环境是临时的,所以我们不能在初始推送之后手动构建它。
在requirements.txt中:
isotoma.depends.zope2_13_8 isotoma.depends.plone4_1 isotoma.plone.heroku
前两个鸡蛋是虚拟软件包,在 维图阿列诺夫。这些是必需的,因为我们需要把 将被使用。
第三个鸡蛋提供bin/plone和bin/migrate。这些帮手 将根据需要和实例动态配置其环境 站点/运行迁移。
我们将使用relstorage来获得廉价的持久存储。我们必须使用1.4.2 在1.5.x系列上,为了避免plpgsql需求,它将 介绍。
在编写它时,似乎只有django python应用程序才能获得数据库 自动。您可以通过添加一个设置为空的文件夹来获取一个设置。py:
django_bait/ settings.py
您需要一个procfile,这样heroku就知道如何运行zope实例:
web: ./bin/plone -p $PORT
进行本地构建
建立您的虚拟机:
virtualenv . ./bin/pip install -r requirements.txt
您可以启动这样的plone实例:
./bin/plone
这将使您在端口8080上运行一个plone实例。默认情况下不会 正在使用任何数据存储。
添加产品
您可以使用zopeskel快速创建新产品:
source bin/activate mkdir src && cd src pip install zopeskel zopeskel plone my.app
然后按照提示操作。确保对genericsetup问题回答yes。
您可以将自己的自定义鸡蛋添加到requirements.txt:
-e src/myapp.app
这些说明告诉您使用file:前缀。他们撒谎。不要。
z3c.autoinclude应该可以找到您的zcml。
然后您应该能够通过zmi或使用 迁移下面描述的脚本。
部署到Heroku
确保所有更改都提交到git repo中。然后:
~/bin/heroku create --stack cedar git push heroku master
那就等等。如果不是超时的话,它应该能正常工作。它需要 部署200多个鸡蛋花了很长时间,Heroku可能认为你的部署已经结束了 错误和超时。
所以编辑您的要求:
isotoma.depends.zope2_13_8 # isotoma.depends.plone4_1 isotoma.plone.heroku
向英雄承诺并推动。
这将建立没有扑通声的zope,大约一半的卵需要建立。 然后,您可以取消对plone依赖项egg的注释,并再次按下以完成操作。
你现在应该有一个工作的水手了!
重新建立门户
默认情况下,您的实际站点不会位于/,而是位于/Plone。我们可以解决 使用一些老式的zope魔术-注意migrate命令可以设置 这是自动为你准备的。
In the ZMI, in ^{tt5}$ create a SiteRoot object. Default settings are fine.
In the ZMI, in ^{tt4}$ create a DTMLMethod containing:
<dtml-let stack="REQUEST['TraversalRequestNameStack']"> <dtml-if "stack and stack[-1]=='zmi'"> <dtml-call "stack.pop()"> <dtml-call "REQUEST.setVirtualRoot('zmi')"> <dtml-else> <dtml-call "stack.append('Plone')"> </dtml-if> </dtml-let>In the ZMI, at ^{tt4}$ create an AccessRule and point it at the DTMLMethod we just created.
现在对/foo的任何请求都将由/Plone/foo和任何请求处理 对于/zmi/manage,将由/manage处理。成功。
迁移工具
迁移脚本使用isotoma.recipe.plonetools的plone设置特性 自动设置站点。它可以应用配置文件、安装产品、设置属性 甚至叫随机变异。
将migrate.cfg添加到项目的根目录:
[main] # The id of the Plone Site that is created. Default is Plone. site-id = Plone # The admin user that was created by mkzopeinstance - for us it will almost # certainly be admin. Default is admin. admin-user = admin # Whether or not to apply the SiteRoot/AccessRule policy described in the previous # section. Default is False. rootify = True # List of products to install on the initial migrate (when ``/Plone`` is created) products-initial = Products.foo # List of products to install (or reinstall) every time migrate is run products = Products.LinguagePlone # List of GenericSetup profiles to apply the first time migrate is run (when # ``/Plone`` is created) profiles-initial = myapp.policy:initial # List of GenericSetup profiles to apply every time ``bin/migrate`` is run profiles = myapp.policy:default
这句话毫无意义,但它确实表明了你能做什么。在本地运行:
./bin/migrate -c migrate.cfg
与你的Heroku应用程序竞争:
~/bin/heroku run ./bin/migrate -c migrate.cfg
默认设置是在不需要的分支的根目录中查找migrate.cfg 必须告诉它-你只需要./bin/migrate。
维护应用程序
你可以用内置的英雄ku日志工具:
./bin/heroku logs
可以使用debug命令让解释器指向数据库:
./bin/heroku run ./bin/debug
您可以使用run命令在git repo中运行脚本:
./bin/heroku run ./bin/run scripts/myscript.py
等瘤.倍体.希律库
0.0.0(2011-09-29)
- 初始版本