Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to minify html files using django-pipeline

In accordance with the django-pipeline docs, I've added 'pipeline.middleware.MinifyHTMLMiddleware', to my MIDDLEWARE_CLASSES to minify html files. But, when I check the htmls that have been rendered while running the server, they are not minified. Can some one please suggest if I am missing anything.

Below are my MIDDLEWARE_CLASSES. I even tried with GZipMiddleware class enabled, but it still does'nt work. I have also tried with both DEBUG = False & DEBUG = True in settings.py with no success.

MIDDLEWARE_CLASSES = (
    #'django.middleware.gzip.GZipMiddleware',                            
    'pipeline.middleware.MinifyHTMLMiddleware',                         

    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'Testapp.signin.views.SocialAuthExceptionMiddleware',               

)

EDIT: Added Installed Apps and Static files storage settings.

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #'django.contrib.admin',
    'social.apps.django_app.default',
    # 'django.contrib.admindocs',
    'Testapp',
    'signin',

    'pipeline',
)

STATICFILES_STORAGE     = 'pipeline.storage.PipelineCachedStorage'
like image 597
kurrodu Avatar asked Mar 21 '14 03:03

kurrodu


1 Answers

To work pipeline MinifyHTMLMiddleware change DEBUG = False in settings.py

DEBUG = false

Or add in settings.py

PIPELINE_ENABLED = True
like image 94
zetanova Avatar answered Sep 29 '22 19:09

zetanova