[Grok-dev] Enable gzip/http compression in Grok/Zope site

Hector Blanco white.lists at gmail.com
Mon Aug 2 15:52:30 EDT 2010


Thank you

The best thing at this point would be able to get the paster using the
gzipper to send compressed files.

I've been trying the "gzipper" but I guess I am still not setting the
right options in the "deplopy.ini"...

Will keep looking! Thanks again!

2010/8/2 Steve Schmechel <steveschmechel at yahoo.com>:
> Paste has a compression module.  (I have never tried it.)
> http://pythonpaste.org/modules/gzipper.html
>
> You would add something like this to your Grokproject-generated "ini" files:
>  [pipeline:main]
>  pipeline = gzip grok
>
>  [filter:gzip]
>  use = egg:Paste#gzip
>
>
> You could write your own WSGI middleware, if there are certain things you want to compress.
> http://pylonsbook.com/en/1.1/the-web-server-gateway-interface-wsgi.html#altering-the-response
>
> If you want everything compressed, it might be simpler to just put the your Grok site behind Apache or Nginx and let them handle the compression.
> http://grok.zope.org/documentation/how-to/grok-virtual-hosting-and-nginx
> http://wiki.nginx.org/NginxHttpGzipModule
>
> Another option would be to use mod_wsgi to let Apache serve your application directly (and enable mod_deflate):
> http://grok.zope.org/documentation/tutorial/installing-and-setting-up-grok-under-mod-wsgi/tutorial-all-pages
>
> Hope one of these works for you,
> Steve
>
> --- On Mon, 8/2/10, Hector Blanco <white.lists at gmail.com> wrote:
>
>> From: Hector Blanco <white.lists at gmail.com>
>> Subject: Re: [Grok-dev] Enable gzip/http compression in Grok/Zope site
>> To:
>> Cc: grok-dev at zope.org
>> Date: Monday, August 2, 2010, 1:49 PM
>> Ooooh... Then is "paster"
>>
>> And when I try to google "paster web server enable gzip",
>> it tries to
>> search "paste web server enable gzip"... and there's a lot
>> of
>> copy/paste in the world...  :-D
>>
>> Thanks for the hint... I'm sure I'll end up finding
>> something useful
>>
>> 2010/8/2 Danny Navarro <j at dannynavarro.net>:
>> > On Mon, Aug 2, 2010 at 7:10 PM, Hector Blanco <white.lists at gmail.com>
>> wrote:
>> >> Thank you for your answer...
>> >>
>> >> The problem is that I'm using Jetty and it doesn't
>> seem to work as expected...
>> >
>> > Jetty is a server for Java applications. In the case
>> of Grok you need
>> > to look for HTTP servers that support WSGI.
>> > http://wsgi.org/wsgi/Servers
>> >
>> >>
>> >> I'll keep looking! Thank you again
>> >>
>> >> 2010/8/2 Danny Navarro <j at dannynavarro.net>:
>> >>> On Mon, Aug 2, 2010 at 5:52 PM, Hector Blanco
>> <white.lists at gmail.com>
>> wrote:
>> >>>> Hello everyone...
>> >>>>
>> >>>> I would like to know how I can send
>> compressed data from my server
>> >>>> (using Grok/Zope3).
>> >>>
>> >>> HTTP compression should be done by the HTTP
>> server. For Apache, for
>> >>> example, you can enable mod_deflate in the
>> Apache configuration file.
>> >>> http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
>> >>>
>> >>> I think most distros have it enabled by
>> default.
>> >>>
>> >>>>
>> >>>> I am using TAL templates to generate the
>> HTML. For instance:
>> >>>>
>> >>>> (template in file test.pt)
>> >>>> -----------------------------------
>> >>>> <html>
>> >>>>        <head>
>> >>>>
>>  <title>TEST</title>
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/forms.css" />
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/layout.css" />
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/nav-horizontal.css" />
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/plugins.css" />
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/tools.css" />
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/typo.css" />
>> >>>>                <link
>> rel="stylesheet" type="text/css" tal:attributes="href
>> >>>> static/css/colorpicker.css" />
>> >>>>
>> >>>>                <script
>> type="text/javascript" tal:attributes="src
>> >>>>
>> static/js/jquery-1.4.2.min.js"></script>
>> >>>>                <script
>> type="text/javascript" tal:attributes="src
>> >>>> static/zjs/myutil.js"></script>
>> >>>>                <script
>> type="text/javascript" tal:attributes="src
>> >>>>
>> static/zjs/myincludes.js"></script>
>> >>>> -----------------------------------
>> >>>>
>> >>>> When the user goes to: http://127.0.0.1:8080/my-application/test ,
>> >>>> this is handled in app.py by:
>> >>>>
>> >>>> class Test(grok.View):
>> >>>>        grok.context(Grokserver)
>> >>>>        grok.require('viewsite')
>> >>>>
>> >>>> I would like to know if I can easily send
>> some (or all) of the
>> >>>> information compressed in gzip. The
>> information generated by the
>> >>>> template is huge, and any compression
>> would be helpful.
>> >>>>
>> >>>> If I could get to send the .js files
>> compressed with gzip, it would be
>> >>>> a great improvement (or even better: if I
>> can send the "test" page in
>> >>>> gzip)
>> >>>>
>> >>>> I've been googling a lot and I haven't
>> seen any good way to send
>> >>>> compressed data.
>> >>>>
>> >>>> Thank you in advance!
>> >>>>
>> _______________________________________________
>> >>>> Grok-dev mailing list
>> >>>> Grok-dev at zope.org
>> >>>> https://mail.zope.org/mailman/listinfo/grok-dev
>> >>>>
>> >>>
>> >>>
>> >>> --
>> >>> Danny Navarro | http://dannynavarro.net
>> >>>
>> >> _______________________________________________
>> >> Grok-dev mailing list
>> >> Grok-dev at zope.org
>> >> https://mail.zope.org/mailman/listinfo/grok-dev
>> >>
>> >
>> >
>> >
>> > --
>> > Danny Navarro | http://dannynavarro.net
>> >
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>
>
>
>


More information about the Grok-dev mailing list