新手学习Flask,不知道错哪了。

错误提示如下:

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_app

app = create_app()

if __name__ == '__main__':
    app.run(debug=True)

另一个文件:app/init.py:

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

db = SQLAlchemy


def 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

希望帮我解决问题的大哥留下支付宝账号,10元一个问题,防止我以后不动脑。这次真的不明白错哪了,看了好些资料了。

拉莫斯之舞
浏览 836回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python