0

我正在尝试从文档中启动简单的代码:

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

出了什么问题,或者我在哪里可以找到工作示例?

4

1 回答 1

0

这是导入中的错误。我把它固定在我的叉子里;从那里克隆,然后再试一次。

于 2013-09-02T13:06:00.653 回答