好像不对。
蓝图文件,通常称为views.py
from flask import blueprint, render_template
google_auth = Blueprint('google_auth', __name__)
@google_auth.route('/auth', methods=['GET', 'POST'])
def auth():
#do staff
return render_template('auth.html')
应用程序文件 app.py
form flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = SQLAlchemy(app)
#do stuff
#import the blueprint
#Important note, import the blueprint after the Database functions
from myapp.auth.views import google_auth
app.register_blueprint(google_auth)