像这种问题怎么破 module level import not at top of file 关于 PEP8
时间: 2017-09-20来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>> # config:utf-8 # file : main\__init__.py from flask import Blueprint main_app = Blueprint('main', __name__, template_folder='../views/') from . import views, errors <- 这行:module level import not at top of file # coding:utf-8 # file: main\views.py from flask import url_for, redirect, render_template, session, request, abort, redirect from app import db from . import main_app as main <- 这行 @main.route('/test') def t_test(): return render_template('test.html')
Flask 应用 放到顶层在 views 和 errors 就报 can not import 'main'错误。放到底下吧,就不 PEP 了……

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行