新手Flask遇到问题求帮助,新手Flask遇到问题,错误提示如下:Trace
新手Flask遇到问题求帮助,新手Flask遇到问题,错误提示如下:Trace
错误提示如下:
Traceback (most recent call last): File
"/Users/duzhipeng/project/manage.com/run.py", line 3, in
app = create_app() File "/Users/duzhipeng/project/manage.com/app/init.py", line 11,
in create_app
db.init_app(app) TypeError: init_app() missing 1 required positional argument: 'app'Process finished with exit code 1
其中,run.py:
from app import create_appapp = create_app()if __name__ == '__main__': app.run(debug=True)
另一个文件:app/init.py:
from flask import Flaskfrom flask.ext.sqlalchemy import SQLAlchemydb = SQLAlchemydef create_app(): app = Flask(__name__) app.config.from_object('config') db.init_app(app) from . import views as manage_blueprint app.register_blueprint(manage_blueprint) return app
这次真的不明白错哪了,看了好些资料了。
没有实例 SQLAlchemy 创建db对象。改成下面即可
db = SQLAlchemy()
编橙之家文章,
相关内容
- python web开发书中案例报错ValueError: View function did not r
- Python jQuery将图片URL转换为img 标签方法是什么,,后端使
- python-2.7.5.amd64跑程序时报错ImportError: No module named win3
- Python线程报错AttributeError怎么解决,,在一个文件中写了
- 可以将Python脚本变成能被调用的模块吗?,python脚本,以
- 获取文件MIME type Python什么方法可以实现,,文件的扩展
- flask项目导入报ValueError什么意思?,flaskvalueerror,项目结
- 为什么python输出数据时间比C++长,python输出,C语言中,
- Python Scrapy startproject错误异常代码修改求助,scrapystar
- Python access数据库pywintypes.com_error是什么问题,,使用Py
评论关闭