Have you studied the fabric ?
To implement your example using it, you just need to add it to a file called fabfile.py :
def reset_tables(): ''' Drop and recreate all MySQL tables '''
Then you just need to run fab build to build. And you can run fab -l to see the available commands along with their descriptions.
Guess it's also worth mentioning that the fabric provides some other features that you may (or may not) find useful. Among other things, he received some functions that help deploy files to remote servers and some others that allow you to run remote commands through ssh. Since it looks like you are developing a web project, this may be useful for creating deployment scripts or the like.
obmarg
source share