[Flask] Application structure best practice?

Skip Montanaro skip.montanaro at gmail.com
Thu Apr 13 14:23:25 EDT 2017

I asked a colleague about some mildly confusing (to me) usage of the name
"app". He got it from this tutorial:


Not quite halfway through the blog, he has the reader create an app
directory, then an __init__.py file in it containing these lines:

from flask import Flask

app = Flask(__name__)
from app import views

The author then spends a couple short paragraphs explaining the double-duty
done by the name "app" and the atypical import at the end of the module
(personally, not where I look first for import statements). This seems odd
to me, but if that's the common idiom, I'm happy to go with it. The Flaskr
tutorial has a bit different structure. The lack of an __init__.py file
suggests that it's written using Python 3. I'm stuck with Python 2 for the
foreseeable future, however. Do people use different schemes to setup their
application structures? Is there a "best practice" for the application


Skip Montanaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170413/dff139ea/attachment.html>

More information about the Flask mailing list