我目前正在开发我的网站管理界面。但是,当我测试添加新用户时,我得到以下回溯:
Traceback (most recent call last):
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__
return self.wsgi_app(environ, start_response)
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask_peewee/auth.py", line 170, in login
form.password.data,
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask_peewee/auth.py", line 128, in authenticate
if not user.check_password(password):
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask_peewee/auth.py", line 25, in check_password
return check_password(password, self.password)
File "/home/cody/Documents/Flask/SUPRacing/flask/lib/python2.7/site-packages/flask_peewee/utils.py", line 138, in check_password
salt, hsh = enc_password.split('$', 1)
ValueError: need more than 1 value to unpack
这是我的程序的各个相关领域的代码:model.py
class User(db.Model):
id = IntegerField(primary_key=True)
username = CharField()
password = CharField()
email = CharField(120)
admin = BooleanField(default=False)
active = BooleanField(default=True)
# Flask-Login integration
def is_authenticated(self):
return True
def is_active(self):
return True
def is_anonymous(self):
return False
def get_id(self):
return self.id
# Required for administrative interface
def __unicode__(self):
return self.username
def __repr__(self):
return '<User %r>' % (self.username)
应用程序.py
class UserView(ModelAdmin):
columns = ('username', 'email', 'admin', 'active')
filter_exclude = ('id', 'password')
exclude = ('id')
我确定我遗漏了一些明显的东西,但我想我会发布它以防万一。如果我是,我在这里做错了什么?
这是我执行此操作时管理界面的一些屏幕截图。