I'm building a Pyramid application that needs to serve map tiles to an OpenLayers web map.
TileStache is a WMS tile server that serves the tiles that I need, and I want to access it as a view in my Pyramid app.
On its own, visiting the TileStache url, www.exampletilestacheurl.com/LAYERNAME/0/0/0.png
, works great - it returns the tile properly.
In Pyramid, I want to wrap the TileStache app as a view using pyramid.wsgi.wsgiapp
. My goal is that visiting www.mypyramidapp.com/tilestache/LAYERNAME/0/0/0.png
would work just like the above TileStache url example.
I wrapped the TileStache app to be a view:
from pyramid.wsgi import wsgiapp
@wsgiapp
def tileserver(environ, start_response):
# Enable TileStache tile server
import TileStache
tile_app = TileStache.WSGITileServer('tilestache/tilestache.cfg', autoreload=False)
return [tile_app]
And assigned a route for the view in myapp.__init__.main
:
from tilestache import tileserver
config.add_view(tileserver, name='tilestache')
config.add_route('tilestache', '/tilestache')
But when I visit any url starting with www.mypyramidapp.com/tilestache/
, it just returns IndexError: list index out of range.
Is anyone familiar with how wsgiapp works?