I forgot to mention there is no automatic code reloading. Thus, if
changing any of the .py files you need to do an Apache restart.

The point is that this is just a proof of concept of WSGI bridge at
the moment. The intent would be to have separate package 'modpysfu'
which adds back all that automatic code reloading that mod_python had
as well as mod_python compatible interfaces for stuff.

Graham

2009/12/1 Graham Dumpleton <[email protected]>:
> 2009/11/26 Graham Dumpleton <[email protected]>:
>> I have moved it to:
>>
>>  http://bitbucket.org/grahamdumpleton/apswigpy/
>>
>> I'll add some basic documentation on building and usage.
>
> Quick cheat sheet.
>
> 1. Do a checkout/pull latest code for apswigpy from bitbucket and
> install it. Need this as added a little bridge for WSGI to at least
> get things going.
>
> 2. Add following configuration to Apache. I had this inside its own 
> VirtualHost.
>
> WSGIHandlerScript python-script (apache.wsgi)
>
> <Directory /Users/grahamd/Testing/modpysfu>
> WSGIProcessGroup %{GLOBAL}
> WSGIApplicationGroup modpysfu
> WSGIPassApacheRequest On
>
> AddHandler python-script .py
>
> Options MultiViews FollowSymLinks
> MultiviewsMatch Handlers
>
> Order allow,deny
> Allow from all
> </Directory>
>
> In my case that directory was what DocumentRoot for host was set to.
>
> You would need to Alias it in some way if don't want to do it for 
> DocumentRoot.
>
> 3. Now dump '.py' files in that directory and access URL as if
> accessing them as static file. A couple of examples are:
>
> # hello.py
>
> from apache.httpd import *
> from apache.http_protocol import *
>
> def handler(r):
>    output = '<html><body>Hello World!</body></html>'
>
>    r.status = HTTP_OK
>    ap_set_content_type(r, 'text/html')
>    #ap_set_content_length(r, len(output))
>    ap_rwrite(output, r)
>    ap_rflush(r)
>
>    return OK
>
> # echo.py
>
> from apache.httpd import *
> from apache.http_protocol import *
>
> def handler(r):
>    r.status = HTTP_OK
>    ap_set_content_type(r, 'text/plain')
>
>    for (name, value) in r.headers_in.items():
>        ap_rwrite('%s: %s\n' % (name, value), r)
>
>    ap_rflush(r)
>
>    return OK
>
> Note that this is raw SWIG binding, no mod_python specific additions
> at this point. Some things have had to be Pythonised such as APR
> tables as used by headers_in, but otherwise trying to keep truthful to
> APR/AP APIs.
>
> I know some things don't work, such as 'ap_set_content_length()'. Some
> issue with SWIG bindings type equivalence has to be worked out for
> that one and haven't had chance to read SWIG documentation.
>
> Graham
>

--

You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.


Reply via email to