我正在尝试使用Google的留言簿的python教程,并且不清楚要添加或更改的代码,我现在通过它,所以现在我得到了运行完成的代码时出现内部服务器错误:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google App Engine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google App Engine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google App Engine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google App Engine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google App Engine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google App Engine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\Minhhanh\Desktop\guestbook\guestbook.py", line 34, in get
DEFAULT_GUESTBOOK_NAME)
NameError: global name 'DEFAULT_GUESTBOOK_NAME' is not defined
我不确定如何处理' DEFAULT_GUESTBOOK_NAME',如果我将其更改为其他字符串,我会收到有关留言簿密钥的其他错误。我的代码目前分布在4个文件中:app.yaml,index.yaml,index.html,guestbook.py。不知道该怎么做。
答案 0 :(得分:0)
由于错误声明您没有在任何地方定义名为DEFAULT_GUESTBOOK_NAME的变量。
添加:
DEFAULT_GUESTBOOK_NAME = 'Your default book name'
在使用该变量之前。