def create_database():
 with settings(warn_only=True):
  sudo(('psql -c "CREATE USER %s WITH NOCREATEDB NOCREATEUSER ENCRYPTED PASSWORD E\'%s\'"' % (PG_USERNAME, PG_PASSWORD)), user='postgres')
  sudo(('psql -c "CREATE DATABASE %s WITH OWNER %s"' % (PG_DATABASE, PG_USERNAME)), user='postgres')

def create_database ( ) : with settings ( warn_only = True ) : sudo ( ( 'psql -c "CREATE USER %s WITH NOCREATEDB NOCREATEUSER ENCRYPTED PASSWORD E\'%s\'"' % ( PG_USERNAME , PG_PASSWORD ) ) , user = 'postgres' ) sudo ( ( 'psql -c "CREATE DATABASE %s WITH OWNER %s"' % ( PG_DATABASE , PG_USERNAME ) ) , user = 'postgres' )
creates role and database .