我已經提出了一個應用程序使用Python和谷歌應用程序引擎,該應用程序工作確定迄今本地主機,但是當我部署它使用谷歌應用程序引擎啓動我得到以下內容:渲染網頁谷歌應用程序引擎:上傳拋出「TemplateDoesNotExist:index.html」錯誤
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
handler.get(*groups)
File "/base/data/home/apps/s~legacyexample01/1.357212630820400434/legacyexample.py", line 78, in get
self.response.out.write(template.render(path, template_values))
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/template.py", line 91, in render
t = _load_user_django(template_path, debug)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/template.py", line 113, in _load_user_django
template = django.template.loader.get_template(file_name)
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader.py", line 79, in get_template
source, origin = find_template_source(template_name)
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader.py", line 72, in find_template_source
raise TemplateDoesNotExist, name
TemplateDoesNotExist: index.html
我的代碼如下:
class MainPage(webapp.RequestHandler):
def get(self):
template_values = {}
path = os.path.join(os.path.dirname(__file__), "files/page/index.html")
self.response.out.write(template.render(path, template_values))
class RegisterPage(webapp.RequestHandler):
def get(self):
currentYear = datetime.datetime.now().year
firstYear = currentYear-100
template_values = {
"currentYear" : currentYear,
"firstYear" : firstYear,
}
path = os.path.join(os.path.dirname(__file__), "files/page/register.html")
self.response.out.write(template.render(path, template_values))
application = webapp.WSGIApplication([('/', MainPage),('/registration', RegisterPage),('/sign',RegistrationProccess) ], debug=True)
我的Django 1.3使用和Python 2.7是,這個問題的原因是什麼?請幫助
UPDATE 這裏也是我的YAML configutration
application: legacyexample01
version: 1
runtime: python
api_version: 1
handlers:
- url: /files/image
static_dir: files/image
- url: /files/css
static_dir: files/css
- url: /files/javascript
static_dir: files/javascript
- url: /files/page
static_dir: files/page
- url: /.*
script: legacyexample.py
註冊頁面是否工作,還是都失敗? – RLH 2012-03-02 21:01:35