On 11 January 2021 at 13:14:59, Peter of the Norse (rahmcoff@gmail.com) wrote:
I use multiple settings.py files to do this. Specifically, in my main one, I have what I consider the only acceptable instance of import *.
Slightly off-topic (subject changed to reflect that), but there are other exceptions as well that conform to a similar pattern.
For example, refactoring models.py to a package requires adding an import into __init__.py (unless you want to change all dependent code and often needlessly cluttering import statements). Importing `*` instead if individual submodules into `__init__.py` is often the way to go and leads to less changes when you add models in new modules.
PEP8 doesn't explicitly disallow this, but only strongly recommends against it, but the concern is very project specific. I just use it in django for this use case but rarely otherwise.
Regards,
/d
No comments:
Post a Comment