Last Updated: February 25, 2016
·
730
· qnub

Fabric for configuration changing

Ok, i'll try to begin.

So, you (especially if you pythonist) use fabric. If not - you must begin right now! Fabric have many useful things, but can't work with comments locally. So i've fix that issue: https://gist.github.com/2284744

Example:

When i run:

$ fab runserver

my fabfile run:

def runserver():
    luncomment('/etc/hosts', '#-L', use_sudo=True)
    update_settings('develop')
    local('{0} runserver'.format(env.manage))

whish in fact start:

$ ./.env/bin/python ./project/manage.py runserver

with pervious uncomment some domains in /etc/hosts which contain '#-L' comment and switch settings to 'development' variant (uncomment strings which contain '#-D' and comment which contains '#-P' and '#-T')