1 def test_app_is_testing(self):
self.assertIs(current_app.config[‘TESTING’],True)
2manager.add_command(“shell”,Shell(make_context=make_shell_context())),make_shell_context应该没有括号
3html要关
<a>
后面有</a>
4AttributeError
AttributeError: ‘User’ object has no attribute ‘is_active’
你应该UserMixin在你的模型上进行子类化。您还应该添加一个user_loader
from flask.ext.login import UserMixin
from yourapp import login_manager
@login_manager.user_loader
def get_user(ident):
return User.query.get(int(ident))
class User(db.Model, UserMixin)
id = db.Column(db.Integer, primary_key=True)
### yada yada, you know what goes here
5from flask_wtf import FlaskForm #Form改为FlaskForm
6OperationalError: (sqlite3.OperationalError) no such column: users.confirmed
在添加那一行模型属性之后创建迁移(migrate)脚本:
python manage.py db migrate -m “your description”
创建完迁移脚本后,再更新数据库:
python manage.py db upgrade