cevincheung
V2EX  ›  问与答

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

  •  
  •   cevincheung · Sep 19, 2017 · 3024 views
    This topic created in 3175 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   ·   835 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 95ms · UTC 20:58 · PVG 04:58 · LAX 13:58 · JFK 16:58
    ♥ Do have faith in what you're doing.