I am migrating from Django 1.6.5 to Django 1.8.4 I was using South for migrations in 1.6.5 and I followed the instructions here for removing South and using Djangos inbuilt migrations https://docs.djangoproject.com/en/1.8/topics/migrations/#upgrading-from-south
I have a custom user model in accounts.models as:
class User(AbstractUser):
"""
Model extends auth.user and stores more information like city, about me, location etc
"""
I created a new virtualenv in my local machine (mac) and installed Django 1.8 and upgraded all the other required packages, and removed South. The tests ran fine. Interesting, when I did
python manage.py makemigrations
it creates two new files in the auth
app in Django's own folder : .virtualenvs/dj18/lib/python2.7/site-packages/django/contrib/auth/migrations/
This migration works fine locally post that, however, when I commit these migration files (i.e. my own migration files without the auth migrations) into git, and deploy to my production server via fabric and do pip install Django==1.8.4 (full requirements.txt below), the installed Django folders do not have these two new files
[X] 0007_customuser_extensionuser
[X] 0008_auto_20150831_2031
and hence my python manage.py migrate
shows errors
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/core/management/commands/showmigrations.py", line 36, in handle
return self.show_list(connection, options['app_labels'])
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/core/management/commands/showmigrations.py", line 44, in show_list
loader = MigrationLoader(connection, ignore_no_migrations=True)
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
self.build_graph()
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 312, in build_graph
_reraise_missing_dependency(migration, parent, e)
File "/home/ubuntu/.virtualenvs/dj18/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 282, in _reraise_missing_dependency
raise exc
django.db.migrations.graph.NodeNotFoundError: Migration accounts.0002_auto_20150831_2048 dependencies reference nonexistent parent node (u'auth', u'0008_auto_20150831_2031')
I printed out all the migrations from showmigrations after they were applied, so ignore the check boxes (X) to the left of these, just after doing makemigrations the checkboxes should be unchecked
[X] 0001_initial
[X] 0002_auto_20150831_2048
activity
[X] 0001_initial
[X] 0002_auto_20150831_2048
adapter
[X] 0001_initial
admin
[X] 0001_initial
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_customuser_extensionuser ===>this is strangely created in the auth app, not in my own project's app. its code is below
[X] 0008_auto_20150831_2031 ===>this is strangely created in the auth app, not in my own project's app. its code is below
authtoken
[X] 0001_initial
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
default
[X] 0001_initial
[X] 0002_add_related_name
[X] 0003_alter_email_max_length
django_extensions
(no migrations)
djcelery
(no migrations)
feeds
[X] 0001_initial
friends
[X] 0001_initial
globalprefs
[X] 0001_initial
kombu_transport_django
(no migrations)
notification
[X] 0001_initial
push_notifications
[X] 0001_initial
[X] 0002_auto_20150830_2246
rewards
[X] 0001_initial
[X] 0002_auto_20150831_2048
sessions
[X] 0001_initial
sites
[X] 0001_initial
survey
[X] 0001_initial
taggit
[X] 0001_initial
tags
[X] 0001_initial
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.contrib.auth.models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
]
operations = [
migrations.CreateModel(
name='CustomUser',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(null=True, verbose_name='last login', blank=True)),
('email', models.EmailField(unique=True, max_length=255, verbose_name=b'email address')),
('is_active', models.BooleanField(default=True)),
('is_admin', models.BooleanField(default=False)),
('date_of_birth', models.DateField()),
],
),
migrations.CreateModel(
name='ExtensionUser',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(null=True, verbose_name='last login', blank=True)),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, max_length=30, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.', 'invalid')], help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, verbose_name='username')),
('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
('email', models.EmailField(max_length=254, verbose_name='email address', blank=True)),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('date_of_birth', models.DateField()),
('groups', models.ManyToManyField(to='auth.Group', blank=True)),
('user_permissions', models.ManyToManyField(to='auth.Permission', blank=True)),
],
managers=[
('custom_objects', django.contrib.auth.models.UserManager()),
('objects', django.contrib.auth.models.UserManager()),
],
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('auth', '0007_customuser_extensionuser'),
]
operations = [
migrations.DeleteModel(
name='CustomUser',
),
migrations.RemoveField(
model_name='extensionuser',
name='groups',
),
migrations.RemoveField(
model_name='extensionuser',
name='user_permissions',
),
migrations.DeleteModel(
name='ExtensionUser',
),
]
Django==1.8.4
Pillow==2.8.1
Pygments==1.6
Unidecode==0.04.16
django-filter==0.11.0
djangorestframework==3.1.3
oauthlib==1.0.3
python-openid==2.2.5
python-social-auth==0.2.12
requests==2.7.0
requests-oauthlib==0.5.0
six==1.9.0
wsgiref==0.1.2
psycopg2==2.6.1
dj-database-url==0.2.2
dj-static==0.0.5
gunicorn==19.0
static==0.4
jsonpickle==0.7.2
django-celery==3.1.16
kombu==3.0.24
amqp==1.4.5
django-rest-swagger==0.3.3
django-push-notifications==1.2.1
django-uuidfield
boto==2.12.0
django-s3-storages-utils==0.1.0
django-storages==1.1.8
newrelic==2.52.0.40
djangocms-admin-style==0.2.2
xhtml2pdf==0.0.6
django-solo==1.1.0
jsonfield==1.0.0
numpy==1.9.0
django-tinymce==1.5.2
django-debug-toolbar==1.3.2
django-ckeditor-updated==4.4.4
django-stdimage==1.1.2
ipython==3.2.1
rq==0.4.6
django-mailchimp-v1.3==1.3.1
django-annoying==0.8.0
mixpanel-celery==0.8.0
memory-profiler==0.32
bpython==0.13.1
python-dateutil==2.4.2
django-extensions==1.4.8
django-report-builder==2.0.1
supervisor==3.1.3
raven==5.2.0
logentries==0.7
python-memcached==1.53
pylibmc==1.4.1
PyYAML==3.11
django-categories==1.3b8
nose==1.3.7
django-nose==1.4.1
django-queryset-csv==0.3.0
librabbitmq==1.6.1
mixpanel-py==3.2.0
django-cors-headers==1.0.0
responses==0.4.0
factory-boy==2.5.2
psutil==2.2.1
opbeat==3.0.4
django-log-request-id==1.0.0
billiard==3.3.0.20
freezegun==0.3.3
django-taggit==0.17.0
django-taggit-labels==0.3.0
django-taggit-serializer==0.1.1
django-qsstats-magic==0.7.2
django-import-export==0.2.8
Delorean==0.5.0
django-modelclone==0.5.2
dj-inmemorystorage==1.4.0
fake-factory==0.5.2
django-mptt==0.7.40