Ron*_*Ron 0 python google-app-engine
我是GAE和Python的新手,我正在研究google提供的教程,但是当我尝试在同一个文件中创建多个模型类时问题就出现了.如果我添加这样的东西:
class Greeting(ndb.Model):
"""Models an individual Guestbook entry with author, content, and date."""
author = ndb.UserProperty()
content = ndb.StringProperty(indexed=False)
email = ndb.StringProperty()
date = ndb.DateTimeProperty(auto_now_add=True)
colours = ndb.StringProperty(repeated=True)
class UserInformation(ndb.model):
username = ndb.UserProperty()
firstname = ndb.StringProperty(required=True)
lastname = ndb.StringProperty(required=True)
telephone = ndb.IntegerProperty()
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 298, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
obj = __import__(path[0])
File "C:\Python27\gae\listproperty\main.py", line 37, in <module>
class UserInformation(ndb.model):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)
Run Code Online (Sandbox Code Playgroud)
如果我将UserInformation类放入第二个文件并尝试将其导入main.py,我会再次收到类似的错误消息.
我的问题是使用Python在GAE中处理多个ndb.model类的最佳方法是什么?
任何帮助,将不胜感激
Lip*_*pis 10
你有一个错字,改变行:
class UserInformation(ndb.model):
Run Code Online (Sandbox Code Playgroud)
(注意资本M):
class UserInformation(ndb.Model):
Run Code Online (Sandbox Code Playgroud)
它应该工作正常.
| 归档时间: |
|
| 查看次数: |
543 次 |
| 最近记录: |