The Artima Developer Community
Sponsored Link

Python Buzz Forum
Repoze: Me grok speak WSGI

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Carlos de la Guardia

Posts: 219
Nickname: cguardia
Registered: Jan, 2006

Carlos de la Guardia is an independent web developer in Mexico
Repoze: Me grok speak WSGI Posted: Jan 21, 2008 2:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Carlos de la Guardia.
Original Post: Repoze: Me grok speak WSGI
Feed Title: I blog therefore I am
Feed URL: http://blog.delaguardia.com.mx/feed.atom
Feed Description: A space to put my thoughts into writing.
Latest Python Buzz Posts
Latest Python Buzz Posts by Carlos de la Guardia
Latest Posts From I blog therefore I am

Advertisement

I think Repoze is a potentially great thing for the Zope world, so I've been experimenting with getting different Repoze projects running under mod_wsgi and apache, which I think may become the standard deployment solution for production Python WSGI apps.

I recently wrote a step by step guide to setting up Zope and Plone in this manner. Now it's Grok's turn.

Grok is nearing a 1.0 release and is a web development framework which makes the following claims:

  1. Easy to use.
  2. For Python developers.
  3. Powerful.
  4. Based on Zope 3 technologies.

For those of you that will immediately jump and say that claim number four is incompatible with one and two above, please at least visit Grok's web site and give it a try. We are really talking about a Python web development framework here.

Getting Grok to run under mod_wsgi is very easy, but as of this writing you will need to check out repoze.grok from the subversion trunk, since it contains fixes to make the WSGI setup work using the included sample files instead of rolling your own.

Once you have the correct version, setting it up is very straightforward. Install mod_wsgi under Apache and make sure you have a Python 2.4 installation ready with setuptools already installed. Check my post on Plone behind mod_wsgi if you need more detailed instructions for this.

Next, install and run repoze.project:

$ easy_install-2.4 -f http://dist.repoze.org repoze.project

Repoze uses virtualenv to create sandboxes for the applications it runs, so that each one has an independent Python environment of its own and avoids egg conflicts with other applications. To create the Grok sandbox:

$ repozeproject repoze.grok --path=/home/cguardia/repoze/grok

Now all you need to do is copy the contents of the apache2.conf file from the etc directory in your sandbox into your Apache configuration (with the appropiate editsfor your site, of course) and rename the sample-users.zcml file in the same directory to users.zcml (or create you own) and Grok is ready to run.

Since this configuration is intended for production use, you will also need to setup a ZEO server and configure the zope process to connect to it. Just run 'bin/mkzeoinstance .' from your sandbox directory and add the required configuration to the zope.conf file. Here is an example:

<zodb_db main>
cache-size 5000
<zeoclient>
server localhost:8100
storage 1
cache-size 20MB
name zeostorage
var $INSTANCE/var
</zeoclient>
mount-point /
</zodb_db>

That's all there is to it, you can now run Grok behind mod_wsgi by restarting the ZEO and Apache processes:

$ bin/zeoctl start
$ sudo apache2ctl start
You Grok application is ready to run under mod_wsgi, and perhaps be combined with other Python WSGI applications on the same site.


Read: Repoze: Me grok speak WSGI

Topic: TurboGears 2 tutorial at Pycon Previous Topic   Next Topic Topic: From Hash Key to Haskell

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use