Esempio n. 1
0
def check_database():
    """Makes sure the database is accessible"""

    if _utils.test_database():
        print green("Database is available")
    else:
        settings = _utils.django_settings()
        print red("Database is not available! (%s)" % settings.DATABASES['default']['NAME'])
Esempio n. 2
0
def clear_cache():
    """Deletes the cached static files"""

    settings = _utils.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")