TL;DR - Using django-custom-user and django-registration-redux, I am having trouble setting up a postgres database even on a virgin instance. It complains of a non-existent relationship, and I don't see why or where. The detail of the question below is not long but includes some error snippets that are moderately long. Any pointers much appreciated.
Using django-custom-user, I've learned that I must first make a migration for custom_user before the remaining migrations will work. Fair enough. On a clean instance (just created a database and git clone'd the code), I type
python manage.py makemigrations custom_user
python manage.py makemigrations
python manage.py migrate
But... no, I'm missing custom_user_emailuser. I suspect this means a relationship from custom_user on key emailuser, but I still find myself stumped on where this comes from and so what to do about it. Any tips much appreciated.
╭╴ (user-model-74=) [virt]╶╮
╰ [T] django@beta11:django $ python manage.py migrate
Operations to perform:
Synchronize unmigrated apps: admindocs, kernel, messages, staticfiles, blog
Apply all migrations: custom_user, sites, auth, sessions, contenttypes, registration, admin
Synchronizing apps without migrations:
Creating tables...
Creating table blog_blogentry
Creating table kernel_userprofile
Creating table kernel_trippending
Running deferred SQL...
Traceback (most recent call last):
File "/src/django/venv/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
psycopg2.ProgrammingError: relation "custom_user_emailuser" does not exist
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/src/django/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/src/django/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/src/django/venv/lib/python3.4/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/src/django/venv/lib/python3.4/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/src/django/venv/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 179, in handle
created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
File "/src/django/venv/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 317, in sync_apps
cursor.execute(statement)
File "/src/django/venv/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/src/django/venv/lib/python3.4/site-packages/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/src/django/venv/lib/python3.4/site-packages/django/utils/six.py", line 658, in reraise
raise value.with_traceback(tb)
File "/src/django/venv/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "custom_user_emailuser" does not exist
╭╴ (user-model-74=) [virt]╶╮
╰ 1,[T] django@beta11:django $
which I don't understand, even worse because the custom_user migration doesn't call for such a thing:
╭╴ (user-model-74=) [virt]╶╮
╰ [T] django@beta11:django $ more venv/lib/python3.4/site-packages/custom_user/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
]
operations = [
migrations.CreateModel(
name='EmailUser',
fields=[
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_nam
e='ID')),
('password', models.CharField(verbose_name='password', max_length=128)),
('last_login', models.DateTimeField(null=True, blank=True, verbose_name='last login')),
('is_superuser', models.BooleanField(help_text='Designates that this user has all permiss
ions without explicitly assigning them.', verbose_name='superuser status', default=False)),
('email', models.EmailField(verbose_name='email address', unique=True, max_length=255, db
_index=True)),
('is_staff', models.BooleanField(help_text='Designates whether the user can log into this
admin site.', verbose_name='staff status', default=False)),
('is_active', models.BooleanField(help_text='Designates whether this user should be treat
ed as active. Unselect this instead of deleting accounts.', verbose_name='active', default=True)),
('date_joined', models.DateTimeField(verbose_name='date joined', default=django.utils.tim
ezone.now)),
('groups', models.ManyToManyField(related_name='user_set', to='auth.Group', help_text='Th
e groups this user belongs to. A user will get all permissions granted to each of their groups.', blank=T
rue, verbose_name='groups', related_query_name='user')),
('user_permissions', models.ManyToManyField(related_name='user_set', to='auth.Permission'
, help_text='Specific permissions for this user.', blank=True, verbose_name='user permissions', related_q
uery_name='user')),
],
options={
'abstract': False,
'verbose_name': 'user',
'swappable': 'AUTH_USER_MODEL',
'verbose_name_plural': 'users',
},
),
]
╭╴ (user-model-74=) [virt]╶╮
╰ [T] django@beta11:django $