def check_database(): """Makes sure the database is accessible""" if fabutils.test_database(): print green("Database is available") else: settings = fabutils.django_settings() print red("Database is not available! (%s)" % settings.DATABASES['default']['NAME'])
def clear_cache(): """Deletes the cached static files""" settings = fabutils.django_settings() if hasattr(settings, 'COMPRESS_ROOT'): cache_dir = settings.COMPRESS_ROOT / settings.COMPRESS_OUTPUT_DIR # a safety check if cache_dir.exists() and cache_dir.endswith("CACHE"): print green("Removing %s" % cache_dir) cache_dir.rmdir_p() print "Clear cache successful." else: print yellow("Django not configured for static file compression")