我正在使用Plone 4 CMS编辑网站。我目前使用的Plone实例由我无法访问的服务器托管(即我无法FTP此服务器并编辑PHP文件)。
虽然我不拥有托管此网站的服务器,但我想访问buildout.cfg
文件。有没有办法通过登录我的Plone网站来编辑这个文件,或者我是否需要凭据来操纵FTP的整个网站实例?
当我登录时,我可以转到名为Site Setup的页面(提供屏幕截图)。我可以从这个页面解决我的问题吗?
你不能。 buildout.cfg
文件用于安装/构建您的应用程序。因此,当您进入站点设置时,您已经在使用要重新配置的正在运行的应用程序。
你将编辑你的buildout.cfg
然后你将运行./bin/develop rb
来重建它,然后你将(重新)启动你的应用程序的实例。例如,您将看到可用于从站点设置/加载项(您在buildout.cfg的eggs / zcml / versions部分中添加的加载项)激活它们的新加载项。
理论上它是可能的,下面的代码示例显示了使用浏览器视图的原型,在调用时:
几乎:
import os
from Products.Five.browser import BrowserView
class View(BrowserView):
def __call__(self):
# Let's assume these paths exist:
instance_path = '/path/to/instance'
buildout_config_path = instance_path + 'buildout.cfg'
page_path_in_site = 'front-page'
# Read buildout-config of page in site:
page = self.context[page_path_in_site]
config_content = page.getText()
# Write buildout-config to filesystem:
with open(buildout_config_path, 'w') as fil:
fil.write(page.getText())
# Run buildout, so changes in config take effect:
os.system(instance_path + 'buildout')
# Restart server, so python- and zcml-files get
# (re-)compiled, respectively loaded:
os.system(instance_path + 'bin/instance restart')