我有两个文件app.py
和mod_login.py
应用程序.py
from flask import Flask
from mod_login import mod_login
app = Flask(__name__)
app.config.update(
USERNAME='admin',
PASSWORD='default'
)
mod_login.py
# coding: utf8
from flask import Blueprint, render_template, redirect, session, url_for, request
from functools import wraps
from app import app
mod_login = Blueprint('mod_login', __name__, template_folder='templates')
而python返回这个错误:
Traceback (most recent call last):
File "app.py", line 2, in <module>
from mod_login import mod_login
File "mod_login.py", line 5, in <module>
from app import app
File "app.py", line 2, in <module>
from mod_login import mod_login
ImportError: cannot import name mod_login
如果我删除from app import app
,代码将起作用,但我如何才能访问app.config
?