Advertisement
asciiphil

TileStache with S3 cache redirects

May 30th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import sys, os, httplib
  4.  
  5. sys.path.insert(1, '/home/protected/python')
  6. import TileStache
  7.  
  8. if __name__ == '__main__':
  9.     conn = httplib.HTTPConnection('tiles.aperiodic.net.s3.amazonaws.com')
  10.     conn.request('HEAD', os.environ['PATH_INFO'])
  11.     if conn.getresponse().status == 200:
  12.         print 'Location: http://tiles.aperiodic.net.s3.amazonaws.com' + os.environ['PATH_INFO']
  13.         print ''
  14.     else:
  15.         TileStache.cgiHandler(os.environ, '/home/protected/tilestache.cfg')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement