'flask issue when route is in another file circular import
I have a simple app for now
myproject
---flask_app
----app.py
----app_views.py
in my app.py I have
from flask import Flask
app = Flask(__name__)
from flask_app import app_views
in app_views.py I have
from flask_app import app
@app.route('/test')
def home():
print('im in test route')
return "hello world!"
when I start it I am getting
File "app_views.py", line 4, in <module>
@app.route('/test')
AttributeError: partially initialized module 'flask_app.app' has no attribute 'route' (most likely due to a circular import)
Please can someone help? If I put the route in app.py it works but I do not want that
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
