cevincheung
V2EX  ›  问与答

像这种问题怎么破 module level import not at top of file 关于 PEP8

  •  
  •   cevincheung · Sep 19, 2017 · 3004 views
    This topic created in 3165 days ago, the information mentioned may be changed or developed.
    # config:utf-8
    
    from flask import Blueprint
    
    main_app = Blueprint('main', __name__, template_folder='../views/')
    
    
    from . import views, errors <- 这行
    

    Flask 应用 放到顶层在 views 和 errors 就报 can not import 'main'错误。放到底下吧,就不 PEP 了……

    1 replies    2017-09-22 14:55:59 +08:00
    cevincheung
        1
    cevincheung  
    OP
       Sep 22, 2017
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 00:22 · PVG 08:22 · LAX 17:22 · JFK 20:22
    ♥ Do have faith in what you're doing.