I define a blueprint in app/settings/__init__.py
, then import the views to register them. This raises AttributeError: 'function' object has no attribute 'route'
. Why am I getting this error and how do I fix it?
from flask import Blueprint
settings = Blueprint('settings', __name__, template_folder='templates')
from app.settings import views
Traceback (most recent call last):
File "E:/surfmi/run.py", line 1, in <module>
from app import app
File "E:\surfmi\app\__init__.py", line 34, in <module>
from app.settings import settings
File "E:\surfmi\app\settings\__init__.py", line 6, in <module>
from app.settings import views
File "E:\surfmi\app\settings\views.py", line 17, in <module>
@settings.route('/general')
AttributeError: 'function' object has no attribute 'route'
所有评论(0)