[mapserver-users] using mod_wsgi with mapserver

Stephan Meißl stephan at meissl.name
Thu Aug 18 09:05:44 EDT 2011


Hi Mukesh,

your Python script "wsgi-script.wsgi" needs to have a method named
"application()" which needs to accept two parameters and has to return
the response body (see e.g. [1] for details). 

Inside this method you can use MapScript like in the below incomplete
example (see [2] for details):

def application(environ, start_response):
    ows_req = mapscript.OWSRequest()
    ...
    mapscript.msIO_installStdoutToBuffer()
    dispatch_status = map.OWSDispatch( ows_req )
    mapscript.msIO_stripStdoutBufferContentType()
    result = mapscript.msIO_getStdoutBufferBytes()
    ...
    return [result]

HTH,
Stephan

[1] http://webpython.codepoint.net/wsgi_application_interface
[2] http://mapserver.org/mapscript/mapscript.html#mapscript-functions


On Wed, 2011-08-17 at 14:59 -0700, Mukesh Subedee wrote: 
> Hi all,
> 
> 
> I have configured and tested a simple application with mod_wsgi and
> found that its working properly. Now I am trying to use mod_wsgi with
> MapServer. I have configured my Apache virtual host for wsgi as: 
>  
> Alias / /home/public_html/wsgi/
>     <Directory /home/public_html/wsgi>
> 
>         Options ExecCGI Indexes
>         DirectoryIndex index.html index.wsgi index.cgi
> 
>         AddHandler cgi-script .cgi
> 
>         AddHandler wsgi-script .wsgi
>         #AllowOverride None
> 
>         Order allow,deny
>         Allow from all
>     </Directory>
> 
> 
> I tried running similarly as python mapscript but could not get the
> result. I could not find any example that uses mod_wsgi with
> mapscript. Anyone have any idea how it can be used? Any working
> example?
> 
> 
> Thanks,
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list