Shuo
Shuo

Reputation: 8937

django data migration dependency on contrib.sites

I want to add the sites to the dependencies for one of my data migration.

class Migration(migrations.Migration):

    dependencies = [
        ('jianguo', '0004_auto_20141006_1534'),
        ('django.contrib.sites', '__first__'),
    ]

    operations = [
        migrations.RunPython(create_site)
    ]

But I got

ValueError: Dependency on unknown app: django.contrib.sites

Anyone did this before? Thanks.

Upvotes: 1

Views: 927

Answers (1)

user1415946
user1415946

Reputation:

Just ran into the same problem. Apparently you have to omit the 'django.contrib.' when referring to models/apps from the django.contrib name space.

Replace 'django.contrib.sites' => 'sites' when referring to the django.contrib.sites in dependencies or when using apps.

Upvotes: 1

Related Questions