私は次のモデルを持っています:
class Book(ndb.Model):
title = ndb.StringProperty()
description = ndb.TextProperty()
私のハンドラー:
class UploadBookHandler(webapp2.RequestHandler):
def post(self):
title = self.request.get('title')
logging.info(title)
description = self.request.get('description')
logging.info(description)
#category = Category(id=4785074604081152)
book = Book()
book.title=title
book.description=description
book.put()
#todo.category=category
curl すると --data "title=test&description=testmore" localhost:9082/uploadbook
このエラーが発生し続けます:
ERROR 2013-05-23 09:46:34,174 wsgi.py:219]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
File "/Users/johnwesonga/projects/todolist/todolist.py", line 26, in <module>
class UploadTodoHandler(webapp2.RequestHandler):
File "/Users/johnwesonga/projects/todolist/todolist.py", line 37, in UploadTodoHandler
book.put()
NameError: name 'book' is not defined