Enabling WMS server functions with Python Mapscript

David Huttleston Jr dhjr at HDDESIGN.COM
Mon May 22 01:24:43 EDT 2006


Myunghwa Hwang <mhwang4 at UIUC.EDU> writes:

> Hello!
>
> I developed a web map service by using Python Mapscript. 
> This application is based on CGI, that is, 
> basic CGI in Apache executes python script.
> I didn't use mod_python. 
> Till now, I didn't include any tags for metadata in my map file, so now I want to include them.
> I looked at how-to doc in MapServer homepage, and got a question. 
> The doc says for wms_onlineresource I have to use the url of mapserv cgi.
> But if I do that, it means that I have to use mapserv cgi for distributing my data 
> and also use a simple cgi using python for my application, doesn't it?

The mapserv cgi script has a bumpy record wrt security.  And, you will bump
into structural limitations soon after your app becomes non-trivial.  IMHO the
mapserv cgi is a useful tool early in a project's life, but not beyond.

When you are using Mapscript, the python script takes the place of the mapserv
cgi wrt crafting URLs and such.

> And this structure seems to be wierd. 
> I found a python script for providing metadata and it used mod_python. 
>
> So if I use mod_python, then don't I need to use mapserv?
> Is there any way for WMS by using only python without any changes?

I don't know WMS via mapserver well enough to comment.

> The next question is if I use mod_python, can I improve the performance of my application?
> I wonder if other people using python and mapserver prefer mod_python to simple cgi.

Apache modules like mod_python and mod_perl have bumpy record as well.  They
greatly increase the complexity of maintaining the security and stability of
apache.  These issues can be moderated by segmenting different apache
instances by their role in your server cluster.  Segmenting is achieved using
apache instances running on separate servers or as jailed processes.  IMO this
is a waste of time since better solutions are easier.  For example, use
mod_fastcgi (see www.fastcgi.com).  It is a simple way to run your CGI
programs as a persistent process, with all the efficiency mod_python provides,
without the risks associated with mod_python and friends.  Another way for
pythonistas is cherrypy (see www.cherrypy.org) which is my personal favorite.
You can run a python http server with about 10 lines of plumbing code.  Use
apache as the front door for access control and encryption, then expose the
cherrypy server via ProxyPass.

> Thanks for your answers ^^.
>
> from Myunghwa Hwang 

Your welcome, and good luck.

David Huttleston Jr



More information about the mapserver-users mailing list