現在、小さな 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()
どんな助けでも大歓迎です!