views:

234

answers:

1

So I am applying zc.buildout to an existing django project. I am wondering about deploying it now. How do I achieve the sandbox effect on a production server?

+2  A: 

Not sure what you mean with "sandbox effect". If you mean "isolated build": yeah, that's what buildout does. Although it can use a per-user cache directory if you told it to in your~/.buildout/default.cfg. If you want really strict sandboxing on your production server you'll have to switch that off.

Deployment usually means some parameters are different than on your development machine. Your web application's debug mode should be switched off; a cron job must be configured; port numbers are not the default 8080 anymore.

Solution: place a deploy.cfg next to your buildout. It should extend your buildout.cfg and only change some settings. The rest of the settings are the same as in your buildout.cfg. Something like:

[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

Something like that!

Reinout van Rees