Sunday, April 29, 2012

Re: buildout development vs. deployment

On 25-04-12 12:21, Reikje wrote:
> Hi, I am looking into buildout to deploy a django webapp and all it's
> dependencies. I find it quite useful even during development because it
> forces you to keep track of your dependencies. A question regarding some
> best practices. Lets say I have buildout.cfg and setup.py in my project
> root and checked in into SCM. My webapp is listed under develop in
> buildout.cfg. While this is great, during deployment this is probably
> not what you want because you wanna lock the version of your source
> code. I want to do a git revision checkout to archive this. So i guess I
> need to maintain two different buildout.cfg files, one for development
> and one for deployment. How can this be organized to avoid DRY?

I have a production.cfg that extends buildout.cfg. I can then add extra
parts ("set up a supervisord to run gunicorn") of modify settings in
existing ones ("use port 10026 instead of 8000").

I get to keep it pretty DRY that way.

Note that I make proper packages out of my development apps and stick
them somewhere that buildout can find them. You could try to use the
mr.developer add-on to check out tags of your stuff.

For hints on getting your own packages up on a pypi of your own:
http://reinout.vanrees.org/weblog/2009/11/09/eggproxy-plus-private-packages.html
That ought to give you some hints.

> On a side note, what are the alternatives to buildout. Maybe there is
> something even better :)

Buildout provides two things:

- Installation + isolation of python packages, just like the
pip+virtualenv environment. With the note that buildout works just fine
on windows and that pip won't install binary windows eggs. Otherwise the
effect is mostly the same, though I like buildout's version handling
better as it is impossible to forget it (unlike forgetting to pass pip a
requirements.txt file).

- Add-on recipes for extra automation. Great for deployment. Generating
nginx/apache config files, setting up a cron job, creating
your_site_dir/var/log directories and so on.

=> for handling everything *within* your project directory, nothing
beats the functionality of buildout. And it combines fine with tools
like fabric that can handle everything outside of the project directory.


Reinout


--
Reinout van Rees http://reinout.vanrees.org/
reinout@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment