Hi!
I'm trying to add Askbot to an existing project and have merged settings.py and urls.py from setup_templates into my own settings.py and urls.py. But when I'm migrating askbot (python manage.py migrate askbot) I get the following error:
> askbot:0006_add_subscription_setting_for_comments_and_mentions
**************
Adding subscription on comment responses and name mentions for each user.
frequency will be automatically set to the most frequent selection
that user made for any other types of subscriptions
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/management/commands/migrate.py", line 105, in handle
ignore_ghosts = ignore_ghosts,
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/__init__.py", line 191, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/migrators.py", line 221, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/migrators.py", line 292, in migrate_many
result = self.migrate(migration, database)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/migrators.py", line 125, in migrate
result = self.run(migration)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/migrators.py", line 99, in run
return self.run_migration(migration)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/migrators.py", line 81, in run_migration
migration_function()
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in <lambda>
return (lambda: direction(orm))
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/askbot/migrations/0006_add_subscription_setting_for_comments_and_mentions.py", line 26, in forwards
for user in orm['auth.User'].objects.all():
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/models/query.py", line 107, in _result_iter
self._fill_cache()
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/models/query.py", line 772, in _fill_cache
self._result_cache.append(self._iter.next())
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/models/query.py", line 273, in iterator
for row in compiler.results_iter():
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 680, in results_iter
for rows in self.execute_sql(MULTI):
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
cursor.execute(sql, params)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/backends/util.py", line 34, in execute
return self.cursor.execute(sql, params)
File "/Users/olle/Developer/virtualenvs/archileaks/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
return self.cursor.execute(query, args)
django.db.utils.DatabaseError: column auth_user.website does not exist
LINE 1: SELECT "auth_user"."website", "auth_user"."last_name", "auth...
Any ideas what I'm doing wrong?
I had the same problem. Executing the following before running ./manage.py migrate askbot fixed the silent fails for the rest to commit:
ALTER TABLE "auth_user"
ADD COLUMN "website" varchar(200) NOT NULL DEFAULT '',
ADD COLUMN "location" varchar(100) NOT NULL DEFAULT '',
ADD COLUMN "about" text NOT NULL DEFAULT '',
ADD COLUMN "real_name" varchar(100) NOT NULL DEFAULT '',
ADD COLUMN "gravatar" varchar(32) NOT NULL DEFAULT '';
A easy fix is to change 0001_initial to define those 5 fields as "null=True".
Olle, it seems that first migration of askbot possibly did not work.
Type python manage.py migrate --list - what do you see?
Also you could log in to the database and see what the table auth_user looks like.
In your case I'd start over and try running just migration 1 with command:
python manage.py migrate askbot 0001
Inspect the output and the database structure after the migration, if you find errors, we'll try to fix them.
I restored my database (PostgreSQL) and started over with "python manage.py migrate askbot 0001". This is the output:
relation "askbot_badgedata" does not exist
LINE 1: ..."."slug", "askbot_badgedata"."awarded_count" FROM "askbot_ba...
^
- Soft matched migration 0001 to 0001_initial.
Running migrations for askbot:
- Migrating forwards to 0001_initial.
> askbot:0001_initial
I didn't notice the badge_data error before.
This is what auth_users looks like before migration 0001:
id serial NOT NULL,
username character varying(30) NOT NULL,
first_name character varying(30) NOT NULL,
last_name character varying(30) NOT NULL,
email character varying(75) NOT NULL,
password character varying(128) NOT NULL,
is_staff boolean NOT NULL,
is_active boolean NOT NULL,
is_superuser boolean NOT NULL,
last_login timestamp with time zone NOT NULL,
date_joined timestamp with time zone NOT NULL,
CONSTRAINT auth_user_pkey PRIMARY KEY (id ),
CONSTRAINT auth_user_username_key UNIQUE (username )
And this is how auth_users looks like after migration 0001:
id serial NOT NULL,
username character varying(30) NOT NULL,
first_name character varying(30) NOT NULL,
last_name character varying(30) NOT NULL,
email character varying(75) NOT NULL,
password character varying(128) NOT NULL,
is_staff boolean NOT NULL,
is_active boolean NOT NULL,
is_superuser boolean NOT NULL,
last_login timestamp with time zone NOT NULL,
date_joined timestamp with time zone NOT NULL,
hide_ignored_questions boolean NOT NULL,
gold smallint NOT NULL,
email_isvalid boolean NOT NULL,
email_key character varying(32),
date_of_birth date,
reputation integer NOT NULL,
bronze smallint NOT NULL,
tag_filter_setting character varying(16) NOT NULL,
last_seen timestamp with time zone NOT NULL,
silver smallint NOT NULL,
questions_per_page smallint NOT NULL,
response_count integer NOT NULL,
CONSTRAINT auth_user_pkey PRIMARY KEY (id ),
CONSTRAINT auth_user_username_key UNIQUE (username ),
CONSTRAINT auth_user_reputation_check CHECK (reputation >= 0)
Olle, I don't understand this error, can you email me at evgeny.fadeev@gmail.com ? The migration 1 is not referring to the badgedata table. Possibly your database was not in the true original state when you started the process the second time. It seems as if the migration 1 did not finish.
Evgeny ( 2012-01-19 12:08:17 -0500 )editI am encountering the same issue. My setup also failed at migration 0006. Here is what my auth_user looks like after migration 0005:
Table "public.auth_user"
Column | Type | Modifiers
------------------------+--------------------------+--------------------------------------------------------
id | integer | not null default nextval('auth_user_id_seq'::regclass)
username | character varying(30) | not null
first_name | character varying(30) | not null
last_name | character varying(30) | not null
email | character varying(75) | not null
password | character varying(128) | not null
is_staff | boolean | not null
is_active | boolean | not null
is_superuser | boolean | not null
last_login | timestamp with time zone | not null
date_joined | timestamp with time zone | not null
hide_ignored_questions | boolean | not null
gold | smallint | not null
email_isvalid | boolean | not null
email_key | character varying(32) |
date_of_birth | date |
reputation | integer | not null
bronze | smallint | not null
tag_filter_setting | character varying(16) | not null
last_seen | timestamp with time zone | not null
silver | smallint | not null
questions_per_page | smallint | not null
response_count | integer | not null
So, quite a few fields missing (website, about, gravatar)
I took a look at the initial migration - I guess safe_add_column failed silently and continued to the next column.
Edit: I got it to work after manually adding missing columns. I had to add about 7-8 of them each time 'migrate' reached an error. Also had to drop a few tables that were being added multiple times. Isn't this exactly what south is supposed to prevent? Weird.
btw I'm using Django 1.3.1 and PostgreSQL 8.4.11 and integration with an existing project, existing users, and existing auth system (django-allauth).
Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.
create your Q&A siteAsked: 2012-01-17 05:03:07 -0500
Seen: 316 times
Last updated: Aug 22 '12
sorry, system error, what to do?
comment error message: white text on yellow background
error on upvote: "Sorry, something is not right here..." [fixed]
coffin warning: cannot translate loader
Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
Error asking questions with multiple tags
Copyright Askbot, 2010-2011. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
Forgot to add that the existing project have users.
Olle ( 2012-01-17 06:34:40 -0500 )edit