def main(drop = False): if drop: print "dropping all sqlalchemy tables" db.drop_all() print "creating all sqlalchemy tables" db.create_all()
print "nevermind, then." exit() if drop_all: print "the postgres database is ", app.config[ "SQLALCHEMY_DATABASE_URI"] confirm = raw_input( "\nType YES if you are sure you want to drop tables:") if not confirm == "YES": print "nevermind, then." exit() try: db.drop_all() except OperationalError, e: #database "database" does not exist print e db.create_all() logger.info("connected to postgres {uri}".format( uri=app.config["SQLALCHEMY_DATABASE_URI"])) def setup_couch(): # set up couchdb cloudant_db = os.getenv("CLOUDANT_DB") cloudant_url = os.getenv("CLOUDANT_URL") # do a few preventative checks if (cloudant_db == "ti"): print "\n\nTHIS MAY BE THE PRODUCTION DATABASE!!!" confirm = raw_input( "\nType YES if you are sure you want to run this test:") if not confirm == "YES":
confirm = raw_input("\nType YES if you are sure you want to run this test:") if not confirm=="YES": print "nevermind, then." exit() if drop_all: print "the postgres database is ", app.config["SQLALCHEMY_DATABASE_URI"] confirm = raw_input("\nType YES if you are sure you want to drop tables:") if not confirm=="YES": print "nevermind, then." exit() try: db.drop_all() except OperationalError, e: #database "database" does not exist print e db.create_all() logger.info("connected to postgres {uri}".format( uri=app.config["SQLALCHEMY_DATABASE_URI"])) def setup_couch(): # set up couchdb cloudant_db = os.getenv("CLOUDANT_DB") cloudant_url = os.getenv("CLOUDANT_URL") # do a few preventative checks if (cloudant_db == "ti"): print "\n\nTHIS MAY BE THE PRODUCTION DATABASE!!!" confirm = raw_input("\nType YES if you are sure you want to run this test:") if not confirm=="YES": print "nevermind, then."