Modify

Ticket #385 (closed defect: worksforme)

Opened 4 years ago

Last modified 4 years ago

First migrate after initial set up

Reported by: anonymous Owned by: andrew
Priority: major Milestone: 0.7
Component: migrations Version: 0.6.2
Keywords: Cc:

Description

The commands I've run (removing corporate information):
$./manage.py syncdbSyncing...
Creating table south_migrationhistory
Installed 3 object(s) from 1 fixture(s)

Synced:

mysite.misc
mysite.uploader
mysite.dash
django.contrib.comments
django.contrib.flatpages
django.contrib.admin
django.contrib.auth
django.contrib.contenttypes
django.contrib.sessions
django.contrib.sites
south

Not synced (use migrations):

(use ./manage.py migrate to migrate these)

$ ./manage.py startmigration foo.bar --initial
Creating migrations directory at '/var/www/foobar.com/trunk/foobar/foo/bar/migrations'...
Creating init.py in '/var/www/foobar.com/trunk/foobar/foo/bar/migrations'...

+ Added model 'bar.ModelName?'
+ Added model 'bar.ModelName2'

Created 0001_initial.py.

$ ./manage.py migrate foo.bar
Running migrations for bar:

  • Migrating forwards to 0001_initial.

    foo: 0001_initial

Traceback (most recent call last):

File "./manage.py", line 11, in <module>

execute_manager(settings)

File "/usr/local/lib/python2.5/site-packages/django/core/management/init.py", line 438, in execute_manager

utility.execute()

File "/usr/local/lib/python2.5/site-packages/django/core/management/init.py", line 379, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/usr/local/lib/python2.5/site-packages/django/core/management/base.py", line 195, in run_from_argv

self.execute(*args, options.dict)

File "/usr/local/lib/python2.5/site-packages/django/core/management/base.py", line 222, in execute

output = self.handle(*args, options)

File "/usr/local/lib/python2.5/site-packages/south/management/commands/migrate.py", line 91, in handle

skip = skip,

File "/usr/local/lib/python2.5/site-packages/south/migration.py", line 586, in migrate_app

db.send_pending_create_signals()

File "/usr/local/lib/python2.5/site-packages/south/db/generic.py", line 678, in send_pending_create_signals

self.really_send_create_signal(app_label, list(set(model_names)))

File "/usr/local/lib/python2.5/site-packages/south/db/generic.py", line 718, in really_send_create_signal

verbosity=verbosity, interactive=interactive)

File "/usr/local/lib/python2.5/site-packages/django/dispatch/dispatcher.py", line 166, in send

response = receiver(signal=self, sender=sender, named)

File "/usr/local/lib/python2.5/site-packages/django/contrib/contenttypes/management.py", line 10, in update_contenttypes

db = kwargsdb?

KeyError?: 'db'

I've removed the tables, including the South table. Removed the migrations dir. And started from scratch.
With the same result.

If I make a change to the model:
./manage.py migrate foo.bar
Running migrations for bar:

  • Migrating forwards to 0002_extend_bar.

    foo: 0002_extend_bar

  • Loading initial data for foo.

Error: One or more models did not validate:
auth.user: 'groups' specifies an m2m relation through model <class 'django.contrib.auth.models.user_groups'>, which has not been installed.
auth.user: 'user_permissions' specifies an m2m relation through model <class 'django.contrib.auth.models.user_user_permissions'>, which has not been installed.
auth.group: 'permissions' specifies an m2m relation through model <class 'django.contrib.auth.models.group_permissions'>, which has not been installed.

Installed apps has 'django.contrib.auth'.

My models.py has this:

from django.contrib.auth.models import User
class Bar (models.Model):

user = models.ForeignKey?(User)

Attachments

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone set to 0.7

You appear to be using south 0.6.2 with django trunk - if you are, you'll need to upgrade to South trunk as well, since we don't have a stable release out that supports 1.2 yet (since it itself isn't released).

comment:2 Changed 4 years ago by anonymous

I'm running Django 1.0

comment:3 Changed 4 years ago by andrew

Are you sure? That line (db = kwargs[db]) is only in django 1.2 - I've checked my copy of 1.0, and line 10 of django/contrib/contenttypes/management.py definitely isn't that.

comment:4 Changed 4 years ago by anonymous

Sorry, there was an update on our development servers.
Django version 1.2 alpha 1 SVN-12292

If I upgrade to 0.7 will that help?

comment:5 Changed 4 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to worksforme

Yes, 0.7 supports Django 1.2. I'm in the process of releasing 0.7 RC1 now, but you can just use the tip of the repository if you want.

comment:6 Changed 4 years ago by anonymous

That worked, thank you.
I still get this error:
Error: One or more models did not validate:
auth.user: 'groups' specifies an m2m relation through model <class 'django.contrib.auth.models.user_groups'>, which has not been installed.
auth.user: 'user_permissions' specifies an m2m relation through model <class 'django.contrib.auth.models.user_user_permissions'>, which has not been installed.
auth.group: 'permissions' specifies an m2m relation through model <class 'django.contrib.auth.models.group_permissions'>, which has not been installed.

comment:7 Changed 4 years ago by andrew

That looks like an error we used to get on the old Django 1.2 releases - you should probably move to the beta rather than using alpha 1.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.