Python 名称错误:名称';(随便)及"x27 ;;没有定义
这个错误快把我逼疯了 我正在开发一个应用程序引擎Python应用程序。这些是课程:Python 名称错误:名称';(随便)及"x27 ;;没有定义,python,google-app-engine,Python,Google App Engine,这个错误快把我逼疯了 我正在开发一个应用程序引擎Python应用程序。这些是课程: from google.appengine.ext import db class Usuario(db.Model): user = db.UserProperty() nombre = db.StringProperty(required = True) pasaporte = db.ReferenceProperty(Pasaporte) class Pasaporte(db.Model):
from google.appengine.ext import db
class Usuario(db.Model):
user = db.UserProperty()
nombre = db.StringProperty(required = True)
pasaporte = db.ReferenceProperty(Pasaporte)
class Pasaporte(db.Model):
direccion = db.StringProperty()
telefono = db.PhoneNumberProperty()
class Sindicato(db.Model):
nombre = db.StringProperty(required = True)
direccion = db.StringProperty()
telefono = db.PhoneNumberProperty()
class Sede(db.Model):
nombre = db.StringProperty()
direccion = db.StringProperty()
telefono = db.PhoneNumberProperty()
descripcion = db.StringProperty()
class Servicio(db.Model):
nombre = db.StringProperty()
descripcion = db.StringProperty()
prestador = db.StringProperty()
condiciones = db.StringListProperty()
class UsuarioServicio(db.Model):
usuario = db.ReferenceProperty(Usuario, collection_name='servicios_collection')
servicio = db.ReferenceProperty(Servicio, collection_name='usuario_collection')
fechaRegistro = db.DateTimeProperty(auto_now_add=True)
我不知道为什么,但这是我尝试在localhost中测试我的应用程序时收到的错误消息:
NameError: name 'Pasaporte' is not defined
在UsuarioServicio
类中,我引用了其他类,没有得到任何错误
如果有帮助,我正在Kubuntu10-10中使用Python2.7解释器在EclipsePydev上工作。无论如何,如果我尝试通过“dev_appserver.py”命令从终端启动应用程序,则仍然会显示错误
我的代码有什么问题?
Pasaporte
在Usario
中使用后才会声明。切换这些类的顺序就可以了。Pasaporte
在Usario
中使用后才会声明。切换这些课程的顺序就可以了。为了将来的参考,请在您的问题中包含完整的stacktrace。它通常包含错误描述之外的重要信息。为了将来参考,请在您的问题中包含完整的stacktrace。它通常包含错误描述之外的重要信息。