def db_exists ( ) : logger . info ( "Checking to see if %s already exists" , repr ( DB [ "NAME" ] ) ) try : # Hide stderr since it is confusing here psql ( "" , stderr = subprocess . STDOUT ) except subprocess . CalledProcessError : return False return True
how to check if variable does not exist python
Test if DATABASES [ default ] exists
def db_exists():
    """Test if DATABASES['default'] exists"""
    logger.info("Checking to see if %s already exists", repr(DB["NAME"]))
    try:
        # Hide stderr since it is confusing here
        psql("", stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError:
        return False
    return True