I'm following this tutorial to make a basic Flask app: and I don't understand the line of code in app/view.py that says from app import app
. In that line, what do both of the app
refer to? Do they both refer to the same thing?
Note: I know that there is a folder called app, and that there is an object
app = Flask(__ name__) in __ init__.py
if that helps...
It means:
from package
app
import objectapp
So the first app
is the name of the package (which is a folder with a __init__.py
file inside) and the second is the name of the imported object from that package. See the answers to this question for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With