flask_script python manager 运行报错,flask_scriptpython,利用flask框架进行个
flask_script python manager 运行报错,flask_scriptpython,利用flask框架进行个
利用flask框架进行个人主页开发,在manage.py中利用flask_script添加了shell运行命令,整个manage.py文件代码如下:
"""the launcher of the whole app"""#!/usr/bin/env pythonimport osfrom app import create_app, dbfrom flask.ext.script import Manager, Shellfrom flask.ext.migrate import Migrate, MigrateCommandfrom app.models import Userapp = create_app(os.getenv('FLASK_CONFIG') or 'default')manager = Manager(app)migrate = Migrate(app, db)def make_shell_context(): # initialize the running context of python shell return dict(app=app, db=db)manager.add_command("shell", Shell(make_context=make_shell_context))manager.add_command('db', MigrateCommand)@manager.add_commanddef test(): """Run the unit tests.""" import unittest tests = unittest.TestLoader().discover('tests') unittest.TextTestRunner(verbosity=2).run(tests)if __name__ == "__main__": manager.run()
最后在终端执行python manage.py shell命令时,遇到报错如下:
Traceback (most recent call last): File "manage.py", line 27, in <module> manager.run() File "/home/curry/myproject/blog/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 405, in run result = self.handle(sys.argv[0], sys.argv[1:]) File "/home/curry/myproject/blog/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 342, in handle app_parser = self.create_parser(prog) File "/home/curry/myproject/blog/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 168, in create_parser command_parser = command.create_parser(name, parents=[options_parser])AttributeError: 'function' object has no attribute 'create_parser'
似乎是flask_script本身运行出了问题,对于这种追溯到module源代码中的错误分析不太知道分析方法,希望有高人能够讲解一下,谢谢
编橙之家文章,
相关内容
- Mac正常连接sql server,安装pymssql报错,sqlpymssql,我已经安
- 求谷歌 PR查询接口URL校验码Python算法或思路,校验码
- 跨平台截图Python+WxPython如何调试,截图pythonwxpython,如题
- Python自动创建不存在文件方法是什么?,python不存在,使
- Mac osx平台安装anaconda之后没法使用,有遇到的吗?,
- Python正则非贪婪匹配多行方法是什么,python匹配多行
- 用python pyquery采集淘宝遇到的编码问题,pythonpyquery,代码
- SAE saecloud程序怎么开启,saesaecloud开启,我想部署django到
- android获得农历时间python有什么开源库或者包吗,andro
- 求模拟多个client对网络带宽进行竞争的思路,client网络
评论关闭