我现在正在将我的小型 Google App Engine 应用程序迁移到 Heroku 平台。我实际上并没有使用 Bigtable,并且webapp2
大大降低了我的迁移成本。
现在我坚持处理静态文件。
有什么好的做法吗?如果是这样,请带我去那里。
提前致谢。
编辑
好吧,我现在正在使用paste
我的 WSGI 服务器。并且paste.StaticURLParser()
应该是我实现静态文件处理程序所需要的。但是我不知道如何将它与webapp2.WSGIApplication()
. 有人可以帮我吗?
也许我需要重写webapp2.RequestHandler
类才能正确加载paste.StaticURLParser()
;
import os
import webapp2
from paste import httpserver
class StaticFileHandler(webapp2.RequestHandler):
u"""Static file handler"""
def __init__(self):
# I guess I need to override something here to load
# `paste.StaticURLParser()` properly.
pass
app = webapp2.WSGIApplication([(r'/static', StaticFileHandler)], debug=True)
def main():
port = int(os.environ.get('PORT', 5000))
httpserver.serve(app, host='0.0.0.0', port=port)
if __name__ == '__main__':
main()
任何帮助将不胜感激!