コード例 #1
0
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'])
コード例 #2
0
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")
コード例 #3
0
ファイル: tasks.py プロジェクト: nanchenchen/django-showMaf
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")