Back
Mar 06, 2010

Supplementing settings in settings_local

Vladimir Sidorenko
Vladimir Sidorenko

For local project settings, I use old trick with settings_local file:

try:
        from settings_local import *
    except ImportError:
        pass

So in 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 from settings_local:

# settings_local.py

    from settings import *

    INSTALLED_APPS += (
        # ...
    )

Update

Now, couple years later I prefer having separate settings file for different environments, as it is described in 2 scoops of django.

More thoughts

Oct 03, 2016Technology
How to include JQuery plugins in Angular 2 running via webpack

Learn more about how to include jquery plugins in angular 2 running via webpack. Our tutorial is perfect for Angular beginners.

Anton Lysenkov
Anton Lysenkov
Sep 21, 2020Technology
How to Optimize Django ORM Queries

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.

Alexey Demianenko
Alexey Demianenko
Jan 12, 2017Technology
Making Custom Report Tables Using AngularJS and Django

In this article I will tell you how to create an interactive interface with a widely customized visual look and different filtering to view reports.

Pasha Volkov
Pasha Volkov
Jan 09, 2017Technology
How to Use GraphQL with Django

GraphQL is a very powerful library, which is not difficult to understand. GraphQL will help to write simple and clear REST API to suit every taste and meet any requirements.

Rostyslav Stekh
Rostyslav Stekh