【发布时间】:2013-12-05 22:56:00
【问题描述】:
我正在尝试将我的 Unity Web Player 应用程序上传到 Google App Engine,但是当我使用 dev_appserver.py 启动服务器时,我在浏览本地主机页面时遇到内部服务器错误 错误 服务器出错或无法执行请求的操作
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/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~gcdc2013-space3d/1.371793060412129756/main.py", line 27, in get
self.response.out.write(template.render(path, template_values))
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/webapp/template.py", line 89, in render
t = _load_internal_django(template_path, debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/webapp/template.py", line 163, in _load_internal_django
template = django.template.loader.get_template(file_name)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loader.py", line 157, in get_template
template, origin = find_template(template_name)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/_internal/django/template/loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: WebPlayer.html
我的 app.yaml 内容
application: gcdc2013-space3d
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /WebPlayer\.unity3d
static_files: WebPlayer/WebPlayer.unity3d
upload: WebPlayer/WebPlayer\.unity3d
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
main.py 内容
from google.appengine.ext.webapp import template
import webapp2
import os
class MainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'greetings': 'greetings',
}
path = os.path.join('WebPlayer', 'WebPlayer.html')
self.response.out.write(template.render(path, template_values))
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
任何帮助将不胜感激
【问题讨论】:
-
IIRC 你应该在一个名为模板的目录中拥有 template.html。这就是 webapp2/jinja2 的默认设置,因此可能值得一试。
标签: django google-app-engine python-2.7 unity3d