Modify

Ticket #511 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

syncdb does not import 'management' module from external apps

Reported by: jaap@… Owned by: andrew
Priority: major Milestone: 0.7.2
Component: commands Version: 0.7.1
Keywords: syncdb management signals Cc:

Description

What steps will reproduce the problem?:

  1. Add defaultsite (http://pypi.python.org/pypi/django-defaultsite/1.1) to INSTALLED_APPS
  2. Run syncdb
  3. Check the created site object

What is the expected output? What do you see instead?:
I expected a site object based on my settings for defaultsite. Instead I see the standard example.com site.

What may cause this:
South overwrites Django's built in syncdb command. Even though in the background the old command still gets called, the following does not always work:

http://code.djangoproject.com/wiki/Signals#Howsignalswork

whenever manage.py syncdb is run, it loops through every application in the
INSTALLED_APPS setting, and looks to see if any apps contain a module called
management; if they do, manage.py imports them before installing any models,
which means that any dispatcher connections listed in an app's management module
will be set up before model installation happens.

I suspect the reason for this is that South builds its own list of apps to sync (apps_needing_sync) based on django.db.models.get_apps().

In my case defaultsite, doesn't provide any models by itself. Therefore it doesn't get included in the lists of apps sent to the 'real' syncdb command.

Attachments

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.7.2

Implemented in [6ce9576a7edd].

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.