Skip to main content

load django dev settings from DJANGO_DEV_SETTINGS_MODULE

Project description

Installation

$ [sudo] pip install django-dev-settings

Pros

  • load multiple projects dev settings from global dev settings module

How it works

create global settings module with:

  • UPPERCASE variables
  • onload() function

load global settings in project dev settings:

import django_dev_settings

django_dev_settings.load()

export DJANGO_DEV_SETTINGS_MODULE environment variable

Functions

function __doc__
django_dev_settings.load() import DJANGO_DEV_SETTINGS_MODULE variables and call onload() function

Examples

site-packages/django_settings/dev.py:

import os
import sys

def load():
    settings_module = sys.modules[os.getenv('DJANGO_SETTINGS_MODULE')]
    settings_module.MIDDLEWARE+=[
        'debug_toolbar.middleware.DebugToolbarMiddleware',
    ]
    for app in [
        'debug_toolbar',
        ...
    ]:
        if app not in settings_module.INSTALLED_APPS:
            settings_module.INSTALLED_APPS.append(app)

DEBUG_TOOLBAR_PANELS = [
    'debug_toolbar.panels.versions.VersionsPanel',
    ...
]
$ export DJANGO_DEV_SETTINGS_MODULE=django_settings.dev
$ python manage.py <command>

django-readme-generator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-dev-settings, version 2019.8.4
Filename, size File type Python version Upload date Hashes
Filename, size django-dev-settings-2019.8.4.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page