这是我的密码型号.py文件。在我尝试为“ID”添加一个新字段之前,一切都正常工作,该字段会随着每个项而递增。这是一个在googleappengine上运行的flask应用程序。你知道吗
from google.appengine.ext import db
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.StringProperty(required = True)
content = db.TextProperty(required = True)
这是我得到的回溯:
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'Column'
Traceback (most recent call last):
File "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/main.py", line 2, in <module>
from blog import app
File "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/__init__.py", line 7, in <module>
import views
File "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/views.py", line 2, in <module>
from models import Post
File "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/models.py", line 3, in <module>
class Post(db.Model):
File "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/models.py", line 4, in Post
id = db.Column(db.Integer, primary_key=True)
我也尝试过,但没有成功:
class Post(db.Model):
id = db.Integer(primary_key=True)
title = db.StringProperty(required = True)
content = db.TextProperty(required = True)
Column
不是成员,因为您没有使用SQLAlchemy。你知道吗我认为那个模型谷歌.appengine.ext.db有一些现成的密钥,请参阅谷歌文档
相关问题 更多 >
编程相关推荐