Back
Mar 6, 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

Sep 1, 2021TechnologyBusiness
Top 10 Web Development Frameworks in 2021 - 2022

We have reviewed the top web frameworks for server and client-side development and compared their pros and cons. Find out which one can be a great fit for your next project.

Marina Sharapova
Marina Sharapova
Feb 28, 2010Technology
Composing multiple views in Django

In UNIX way, each view should solve single task. This is good idea, but sometimes we need to mix logic of different views on same page. Filter, sort, paginate, or, for example, add comment on product page. In this article I'll show how we can mix such multiple views.

Vladimir Sidorenko
Vladimir Sidorenko
Jan 22, 2017Technology
Django vs Rails Performance

This article is aimed for beginners, who are trying to choose between Ruby on Rails and Django. Let’s see which is fastest and why.

Vladimir Sidorenko
Vladimir Sidorenko
May 9, 2018Technology
How to Generate PDF Files in Python with Xhtml2pdf, WeasyPrint or Unoconv

Programmatic generation of PDF files is a frequent task when developing applications that can export reports, bills, or questionnaires. In this article, we will consider three common tools for creating PDFs, including their installation and converting principles.

Vladimir Sidorenko
Vladimir Sidorenko