2009-12-02 152 views
3

因此,我將應用 zc.buildout到現有的django項目中。我想知道現在部署它。如何在生產服務器上實現沙箱效果?構建部署策略

回答

4

不確定你的意思是「沙箱效應」。如果你的意思是「孤立的構建」:是的,這就是構建。雖然如果您在~/.buildout/default.cfg中告訴它,它可以使用每個用戶的緩存目錄。如果你想在你的生產服務器上實現嚴格的沙盒,你必須關閉它。

部署通常意味着某些參數與開發機器上的參數不同。您的Web應用程序的調試模式應關閉;必須配置cron作業;端口號不再是默認的8080。

解決方案:在您的構建旁邊放置一個deploy.cfg。它應該擴展你的buildout.cfg並且只改變一些設置。其餘設置與您的buildout.cfg相同。例如:

[buildout] 
    extends = buildout.cfg 
    parts += 
     startup-cronjob 

    [instance] 
    # Some changes, like port number. 
    http-address = 13080 
    debug-mode = off 
    verbose-security = off 

    [startup-cronjob] 
    # Example part that's new to the deploy.cfg, it wasn't in buildout.cfg. 
    recipe = z3c.recipe.usercrontab 
    times = @reboot 
    command = ${buildout:directory}/bin/supervisord 

這樣的事情!

0

使用包括現場包選項:

[buildout] 
include-site-packages = false 

(我知道我挖一個老問題,但它在搜索結果中彈出)