Running migrate for the second time fails.
See original GitHub issueHere is what I followed:
> mkdir cookiecutter-django-test
> cd cookiecutter-django-test
> virtualenv env
> . env/bin/activate.fish
> pip install cookiecutter
> cookiecutter https://github.com/pydanny/cookiecutter-django.git
and here is what I answered for the questions
project_name [project_name]: cookiecutter-django-test
repo_name [cookiecutter-django-test]:
author_name [Your Name]: My Name
email [Your email]: my@email.com
description [A short description of the project.]:
domain_name [example.com]:
version [0.1.0]:
timezone [UTC]:
now [2016/01/07]: 2016/01/08
year [2016]:
use_whitenoise [y]:
use_celery [n]: y
use_mailhog [n]: y
use_sentry [n]: y
use_newrelic [n]: y
use_opbeat [n]:
windows [n]:
use_python2 [n]: y
and then
> cd cookiecutter-django-test
> pip install -r requirements/local.txt
> cp ~/mailhog ./
> createdb cookiecutter-django-test
> python manage.py migrate
Everything works fine so far. But as I migrate again, following error is generated:
> python manage.py migrate
Operations to perform:
Apply all migrations: account, users, sessions, admin, sites, kombu_transport_django, contenttypes, auth, socialaccount
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
This is quite strange as I have not modified a single bit. I tried debugging it a little, and following is what I got:
> python manage.py makemigrations
Migrations for 'sites':
0003_auto_20160108_1401.py:
- Alter field domain on site
Full migrations file '0003_auto_20160108_1401.py':
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-08 14:01
from __future__ import unicode_literals
import django.contrib.sites.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0002_set_site_domain_and_name'),
]
operations = [
migrations.AlterField(
model_name='site',
name='domain',
field=models.CharField(max_length=100, unique=True, validators=[django.contrib.sites.models._simple_domain_name_validator], verbose_name='domain name'),
),
]
Migrations for 'users':
0002_auto_20160108_1401.py:
- Alter field username on user
Full migrations file '0002_auto_20160108_1401.py':
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-08 14:01
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='username',
field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=30, unique=True, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.')], verbose_name='username'),
),
]
Although if I make the above migrations and execute them, the problem resolves. But I am unable to understand, why it happens at the first place? It seems that the site domain
and user username
are being modified somehow after running the migrations.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Running migrate for the second time fails. · Issue #464 - GitHub
Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new ......
Read more >Error second time I run a migration. It appears the Generic ...
I am relatively new to EF Core with dependency injection. I come from the old asp.net world of newing classes etc but want...
Read more >vMotion or Storage vMotion of a VM fails with the error
vMotion or Storage vMotion of a VM fails with the error: The migration has exceeded the maximum switchover time of 100 second(s) (2141355)....
Read more >Migration troubleshooting in production - Prisma
Failed migration. A migration might fail if: You modify a migration before running it and introduce a syntax error; You add a mandatory...
Read more >Troubleshoot live migration issues - Windows Server
Or run the KLIST PURGE -li 0x3e7 cmdlet. Failed to create Planned Virtual Machine at migration destination: Logon failure. Description. Live ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I run into the same issue on Ubuntu 14.04 / Python3.4. Cloned my version of cookiecutter-django.git last Friday. Running ‘python manage.py migrate’ twice in a row results in the same message as @efraan got. Similarily running makemigrations generates two files, one for ‘sites’ the other one for ‘users’, with same content as @efraan had.
Ditto. OSX El Cap, python3.5