[Tilecache] tilecache on IIS

Tibor Arpas tibor at infinit.sk
Sat May 17 14:48:07 EDT 2008


Hi,

I saw some requests of people for the abovementioned combination but no easy
answer. Sure there is the option of putting apache with mod_proxy in front
of your IIS but that adds some administration complexicity.

I hoped for a better solution and after some experimenting I got Tilecache
working with the combination

IIS - Pythonwin32 ISAPI - isapi_wsgi

I pretty much followed the tutorial here:
http://wiki.pylonshq.com/display/pylonscookbook/Serving+a+Pylons+app+with+IIS

The script where it's necessary to put Tilecache instead of Pylons goes like
this:

import isapi_wsgi
from TileCache.Service import wsgiApp

# The entry points for the ISAPI extension.
def __ExtensionFactory__():
    return isapi_wsgi.ISAPIThreadPoolHandler(wsgiApp)

if __name__=='__main__':
    from isapi.install import *
    params = ISAPIParameters()
    sm = [
        ScriptMapParams(Extension="*", Flags=0)
    ]
    vd = VirtualDirParameters(Name="tilecache_isapi",
                              Description = "tilecache_isapi",
                              ScriptMaps = sm,
                              ScriptMapUpdate = "replace"
                              )
    params.VirtualDirs = [vd]
    HandleCommandLine(params)

Unfortunately after trying the first request Tilecache didn't go through
it's initialization writing this error:

Internal Extension Error: Failed to import callback module 'tilecache_isapi'
Traceback (most recent call last):
  File "C:\ActivePython25\scripts\tilecache_isapi.py", line 19, in <module>
    from TileCache.Service import wsgiApp
  File
"c:\activepython25\lib\site-packages\tilecache-2.02-py2.5.egg\TileCache\_
_init__.py", line 3, in <module>
    from Layer import *
  File
"c:\activepython25\lib\site-packages\tilecache-2.02-py2.5.egg\TileCache\L
ayer.py", line 6, in <module>
    from Service import TileCacheException
  File
"C:\ActivePython25\lib\site-packages\tilecache-2.02-py2.5.egg\TileCache\S
ervice.py", line 14, in <module>
    workingdir = os.path.abspath(os.path.join(os.getcwd(),
os.path.dirname(sys.a
rgv[0])))
AttributeError: 'module' object has no attribute 'argv'

Seem's like there is no sys.argv attribute in our environment :-(.

I hardcoded my tilecache.cfg location along the line 14 of
Tilecache\Service.py and then it worked :-). Of course hacking the original
code is ugly but I'm new to both Python and Tilecache. My first thought
would be to create a subclass of Tilecache.Service and providing my own
initialization methods. But unfortunately this particular lines of
Tilecache.Service are not enclosed in method which I could override. What
would be the right approach?

Also I didn't test stability and performance, so If anybody has succes using
this combination I would be thankful for comments on these aspects.

Regards,
Tibor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/tilecache/attachments/20080517/c1d82059/attachment.html


More information about the Tilecache mailing list