Flask-Superadmin - 'module'对象没有属性'FileField'

时间:2013-09-02 12:43:55

标签: python flask

我想从文档中启动简单的代码:

https://flask-superadmin.readthedocs.org/en/latest/quickstart.html

以下是代码:

from flask import Flask
from flask.ext.superadmin import Admin

app = Flask(__name__)

admin = Admin(app)

app.run()

但发生以下错误:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from flask.ext.superadmin import Admin
  File "/home/un1t/workspace/dj/python/local/lib/python2.7/site-packages/flask/exthook.py", line 62, in load_module
    __import__(realname)
  File "/home/un1t/workspace/dj/python/local/lib/python2.7/site-packages/flask_superadmin/__init__.py", line 2, in <module>
    from model import ModelAdmin
  File "/home/un1t/workspace/dj/python/local/lib/python2.7/site-packages/flask_superadmin/model/__init__.py", line 1, in <module>
    from .base import ModelAdmin, AdminModelConverter
  File "/home/un1t/workspace/dj/python/local/lib/python2.7/site-packages/flask_superadmin/model/base.py", line 10, in <module>
    from flask_superadmin.form import BaseForm, ChosenSelectWidget, DatePickerWidget, \
  File "/home/un1t/workspace/dj/python/local/lib/python2.7/site-packages/flask_superadmin/form.py", line 115, in <module>
    class FileField(wtf.FileField):
AttributeError: 'module' object has no attribute 'FileField'

我使用以下版本的库:

Flask==0.10.1
Flask-Script==0.6.2
Flask-SuperAdmin==1.7
Flask-WTF==0.9.1
flask-mongoengine==0.7.0
WTForms==1.0.4

有什么问题,或者我在哪里可以找到有效的例子?

1 个答案:

答案 0 :(得分:0)

这是导入中的错误。我把它修好了fork;从那里克隆然后再试一次。