Google App Engine アプリケーションで同じ問題に直面しています。SDK (localhost) では動作しますが、appengine にアップロードすると動作しません。デプロイは成功しました。私はこれで立ち往生しています!!! どんな助けでも感謝します。
以下のトレースバック ログ:
Traceback (most recent call last):
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~cloud-chess/1.368562751153844474/chessboard.py", line 29, in get
template = JINJA_ENVIRONMENT.get_template('files/html/chess.html')
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/loaders.py", line 115, in load
source, filename, uptodate = self.get_source(environment, name)
File "/python27_runtime/python27_lib/versions/third_party/jinja2-2.6/jinja2/loaders.py", line 180, in get_source
raise TemplateNotFound(template)
TemplateNotFound: files/html/chess.html
展開ログ:
01:56 PM Host: appengine.google.com
01:56 PM Application: cloud-chess; version: 2
01:56 PM
Starting update of app: cloud-chess, version: 2
01:56 PM Getting current resource limits.
Password for xxxx.pk@gmail.com: 01:56 PM Scanning files on local disk.
01:56 PM Cloning 17 static files.
01:56 PM Cloning 3 application files.
01:56 PM Uploading 1 files and blobs.
01:56 PM Uploaded 1 files and blobs
01:56 PM Compilation starting.
01:57 PM Compilation completed.
01:57 PM Starting deployment.
01:57 PM Checking if deployment succeeded.
01:57 PM Deployment successful.
01:57 PM Checking if updated app version is serving.
01:57 PM Completed update of app: cloud-chess, version: 2
01:57 PM Uploading index definitions.
2013-07-07 13:57:18 (Process exited with code 0)
チェス盤.py
import os
import webapp2
import jinja2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'])
class MainHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('files/html/chess.html')
self.response.write(template.render())
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
app.yaml
application: cloud-chess
version: 2
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /html
static_dir: files/html/
- url: /images
static_dir: files/images/
- url: /scripts
static_dir: files/scripts/
- url: .*
script: chessboard.app
libraries:
- name: webapp2
version: "2.5.2"
- name: jinja2
version: latest