문제

OpenLayers 웹 맵에지도 타일을 제공 해야하는 피라미드 응용 프로그램을 작성하고 있습니다.

Tilestache는 필요한 타일을 제공하는 WMS 타일 서버이며 피라미드 앱에서 볼 수있는 타일로 액세스하고 싶습니다.

Tilestache URL을 방문하여 자체적으로 www.exampletilestacheurl.com/LAYERNAME/0/0/0.png, 잘 작동합니다 - 타일을 올바르게 반환합니다.

피라미드에서는 Tilestache 앱을 사용한보기로 래핑하고 싶습니다. pyramid.wsgi.wsgiapp. 저의 목표는 그 방문입니다 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')

그러나 내가 시작할 때 URL을 방문 할 때 www.mypyramidapp.com/tilestache/, 그것은 단지 돌아옵니다 IndexError: list index out of range. WSGIAPP의 작동 방식에 익숙한 사람이 있습니까?

도움이 되었습니까?

해결책

tile_app가 WSGI 응용 프로그램 인 경우 그렇게 부르는 결과를 다시 반환해야합니다 ...

from pyramid.wsgi import wsgiapp

# Enable TileStache tile server
import TileStache
tile_app = TileStache.WSGITileServer('tilestache/tilestache.cfg', autoreload=False)

@wsgiapp
def tileserver(environ, start_response):

    return tile_app(environ, start_response)

참고 : 앱 작성을 모듈 레벨로 옮겼으며 요청이 처리 될 때마다 가져 오기에 생성되며 가져 오기가 아닙니다. 그것은 당신이 찾고있는 행동이 아니라 대부분의 시간입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top