【发布时间】:2013-11-07 22:18:49
【问题描述】:
我正在构建一个 Pyramid 应用程序,该应用程序需要将地图图块提供给 OpenLayers 网络地图。
TileStache 是一个 WMS 磁贴服务器,它为我需要的磁贴提供服务,我想在我的 Pyramid 应用程序中以视图的形式访问它。
单独访问 TileStache 网址 www.exampletilestacheurl.com/LAYERNAME/0/0/0.png 效果很好 - 它可以正确返回磁贴。
在 Pyramid 中,我想使用 pyramid.wsgi.wsgiapp 将 TileStache 应用程序包装为视图。我的目标是访问www.mypyramidapp.com/tilestache/LAYERNAME/0/0/0.png 就像上面的 TileStache url 示例一样工作。
我将 TileStache 应用程序包装成一个视图:
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]
并为myapp.__init__.main中的视图分配了一条路线:
from tilestache import tileserver
config.add_view(tileserver, name='tilestache')
config.add_route('tilestache', '/tilestache')
但是当我访问任何以www.mypyramidapp.com/tilestache/ 开头的网址时,它只会返回IndexError: list index out of range. 有人熟悉wsgiapp 的工作原理吗?
【问题讨论】:
标签: python pyramid wsgi tilestache