Django django.contrib.sites where to put migration?
<p>the django doc says to change the sites name and domain in the django.contrib.sites framework one should use a migration [1].</p>

<p>But they forgot to mention where I should put this migration. I tried to create a directory named "sites" and a directory named "django.contrib.sites". But no matter in which directory I put my migration, <code>manage.py migration</code> always says there is nothing to update.</p>

<p>I also tried to run <code>python manage.py makemigrations --empty sites</code>, but then the migration is created in the lib directory: <code>ve/lib/python3.5/site-packages/django/contrib/sites/migrations/0003_auto_20160904_2144.py</code>. This may be correct behaviour, but then I cannot set my change under source control.</p>

<p>In case something is wrong with my migration, here it is:</p>

<pre><code>from __future__ import unicode_literals

from django.db import migrations, models

def set_site_name(apps, schema_editor):
    Sites = apps.get_model('django.contrib.sites', 'site')
    site = Sites.objects.filter(id=1).first()
    if site != None:
        site.name = "name"
        site.domain = "name.com"

class Migration(migrations.Migration):
    initial = True

    operations = [
        migrations.RunPython(set_site_name),
    ]
</code></pre>

<p>So my question is: where does django expect to find those migrations?</p>

<p>Thank you very much in advance for your help.</p>

<p>[1] <a href="https://docs.djangoproject.com/en/1.10/ref/contrib/sites/#enabling-the-sites-framework" rel="nofollow">https://docs.djangoproject.com/en/1.10/ref/contrib/sites/#enabling-the-sites-framework</a></p>

<p>Each app in a Django project must have a unique <a href="https://docs.djangoproject.com/en/1.10/ref/applications/#django.apps.AppConfig.label" rel="nofollow">label</a>. Naming your app <code>sites</code> isn't a good idea - it will clash with the <code>django.contrib.sites</code> app unless you change the label in the app config class.</p>

<p>If you have an existing app specific to your project, you could use that app to store the data migration.</p>

<p>Alternatively choose a different name like <code>mysites</code>. Create the app with <code>./manage.py startapp mysite</code>, add the app to your <code>INSTALLED_APPS</code>, then create a blank migration. </p>

python django django-models