GZipMiddleware and UpdateCacheMiddleware order

93 views
Skip to first unread message

Michael Godshall

unread,
May 18, 2013, 1:23:52 PM5/18/13
to mezzani...@googlegroups.com
What is the correct middleware ordering in Mezzanine for django.middleware.gzip.GZipMiddleware?  

It is my understanding that django.middleware.cache.UpdateCacheMiddleware normally goes before GZipMiddleware like this:

MIDDLEWARE_CLASSES = (
    "django.middleware.cache.UpdateCacheMiddleware" # Mezzanine uses "mezzanine.core.middleware.UpdateCacheMiddleware"
    "django.middleware.gzip.GZipMiddleware",
    ....
)

However, Mezzanine uses its own UpdateCacheMiddleware with two-phase rendering, so if I put it before GZipMiddleware, the {% nevercache %} blocks don't render properly.

The {% nevercache %} blocks render correctly when I put GZipMiddleware first, but I wanted to confirm that this was the correct approach and plays nicely with Mezzanine's UpdateCacheMiddleware.

MIDDLEWARE_CLASSES = (
    "django.middleware.gzip.GZipMiddleware",
    "mezzanine.core.middleware.UpdateCacheMiddleware"
    ....
)

Stephen McDonald

unread,
May 18, 2013, 7:15:45 PM5/18/13
to mezzani...@googlegroups.com
Public facing web server might be a better place for this - I believe NGINX for example will gzip by default.

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Stephen McDonald
http://jupo.org

Michael Godshall

unread,
May 19, 2013, 11:24:08 AM5/19/13
to mezzani...@googlegroups.com, st...@jupo.org
Thanks for your reply, Stephen.  We're on Heroku, so I'll have to look into how they handle gzip.
Reply all
Reply to author
Forward
0 new messages