我试图在模型文件夹中分离这两个方面。我得到了:pony.orm.core.ERDiagramError:无法定义实体'Guest':数据库映射已经生成
这是代码
******* db_session.py *******
from pony import orm
from model.dbase import (Guest, Offer, Payment_method, Extra_services,
Voucher, Reservation, db)
db = orm.Database()
class GuestManager(object):
@orm.db_session
def show_guest(n):
guest = Guest[n]
return guest
***** dbase.py *****
from datetime import date
from pony import orm
db = orm.Database()
db.bind(provider='sqlite', filename='database.sqlite')
orm.sql_debug(True)
db.generate_mapping(create_tables=True)
class Guest(db.Entity):
nome = orm.Required(str)
surname = orm.Required(str)
email = orm.Required(str, unique=True)
感谢您的帮助。