__name__ is just a convenient way to get the import name of the place where the application is defined. The checkbox uses the import name to know where to look for resources, templates, static files, instance folder, etc. When using the package, if you define your application in __init__.py , then __name__ will still point to the βrightβ place as to where the resources are. However, if you define it elsewhere, for example, mypackage/app.py , then using __name__ will indicate a resource search mypackage.app relative to mypackage.app instead of mypackage .
Using __name__ not orthogonal to hardcoding, it is simply a shorthand for using a package name. And also there is no reason to say that the name should be a basic package, it is fully consistent with your project structure.
davidism
source share