Can't override settings with environment variables in Django 1.5

Bug #1180307 reported by Łukasz Czyżykowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
django-configglue
Fix Committed
Undecided
Unassigned

Bug Description

In Django 1.5 the code which monkey-patches django.core.management.ManagementUtility and which is located at the end of django_configglue/management/__init__.py is not run. That's because of the change in which manage.py file is constructed and the order of loading custom management commands.

Because of that schemaconfigglue, which uses shell environment for options, is never run, and there's no way for overriding settings that way.

To fix it temporarily, one have to import django_configglue.management module before Django code (see https://code.launchpad.net/~lukasz-czyzykowski/canonical-identity-provider/fix-managementutility-problem/+merge/163866).

Proper fix will probably require moving the monkey-patching code to a module which is run before Django gets to execute code from its django.core.management module. Probably running it from settings.py should be enough.

Related branches

Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

The better fix is to make this explicit and to avoid any magic monkeypatching.

In the manage.py command, replace

from django.core.management import execute_from_command_line

for

from django_configglue.management import execute_from_command_line

Changed in django-configglue:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.