For local project settings, I use old trick with
try: from settings_local import * except ImportError: pass
settings_local.py we can override variables from
settings.py. I didn't know how to supplement them. For example how to add line to
INSTALLED_APPSwithout copying whole list.
Yesterday I finally understood that I can import
# settings_local.py from settings import * INSTALLED_APPS += ( # ... )
Now, couple years later I prefer having separate settings file for different environments, as it is described in 2 scoops of django.
Django ORM is a very abstract and flexible API. But if you do not know exactly how it works, you will likely end up with slow and heavy views, if you have not already. So, this article provides practical solutions to N+1 and high loading time issues. For clarity, I will create a simple view that demonstrates common ORM query problems and shows frequently used practices.