This is a very specific blog post on what my Fabric fabfile.py looks like for rebuilding my database. This is particularly useful early in a project lifecycle before I start using South for database migrations and instead I am building new tables and columns at a fast clip.
def rebuild_db():
run('mysql -u %s -p%s -e "drop database if exists %s"' % (env.db_user,
env.db_passwd, env.db_schema))
run('mysql -u %s -p%s -e "create database %s"' % (env.db_user,
env.db_passwd, env.db_schema))
virtualenv('python %smanage.py syncdb --noinput' % \
env.deploy_dir)
virtualenv('python %smanage.py loaddata %s/core/' +
'fixtures/test.json' % (env.deploy_dir, env.deploy_dir))
A few notes: