Created
June 26, 2013 23:10
-
-
Save mattdeboard/5872584 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
os.environ.setdefault('SETTINGS_MODULE', 'data.settings_modules.vagrant') | |
from flask_script import Manager | |
from data.settings import DATABASES | |
from web import app | |
manager = Manager(app) | |
@manager.command | |
def dbshell(): | |
db = DATABASES['mydb'] | |
args = ["psql", "--host=%s" % db['HOST'], "--user=%s" % db['USER'], | |
"--dbname=%s" % db['NAME']] | |
os.execvp("psql", args) | |
if __name__ == "__main__": | |
manager.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment