askbot-devel
askbot-devel copied to clipboard
Askbot with haystack, multi-language setup is broken
Askbot version:
$ git log -1
commit 777f5fc190780995f190473d8c567a14ca4d80f2
Author: Evgeny Fadeev <[email protected]>
Date: Sat Dec 19 14:32:03 2015 -0300
fixed issue of conflicting migraions
Language settings in settings.py:
USE_I18N = True
LANGUAGE_CODE = 'en'
ASKBOT_LANGUAGE_MODE = 'url-lang'
LANGUAGES = (
('en', 'English'),
('zh', 'Chinese'),
ENABLE_HAYSTACK_SEARCH = True
HAYSTACK_ROUTERS = ['askbot.search.haystack.routers.LanguageRouter',]
Output of syncdb:
$ /usr/askbot-env/bin/python manage.py syncdb --noinput
System check identified some issues:
WARNINGS:
django_authopenid.UserPasswordQueue.user: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
group_messaging.SenderList.recipient: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
Operations to perform:
Synchronize unmigrated apps: captcha, djkombu, staticfiles, tinymce, messages, keyedcache, sitemaps, compressor, django_countries, humanize, longerusername, haystack
Apply all migrations: followit, livesettings, group_messaging, django_authopenid, sessions, admin, djcelery, robots, auth, sites, askbot, contenttypes
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying auth.0001_initial...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
call_command("migrate", **options)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 154, in apply_migration
self.recorder.record_applied(migration.app_label, migration.name)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 67, in record_applied
self.migration_qs.create(app=app, name=name)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/db/models/query.py", line 348, in create
obj.save(force_insert=True, using=self.db)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/db/models/base.py", line 734, in save
force_update=force_update, update_fields=update_fields)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/db/models/base.py", line 771, in save_base
update_fields=update_fields, raw=raw, using=using)
File "/usr/askbot-env/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 189, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/askbot-env/local/lib/python2.7/site-packages/haystack/signals.py", line 43, in handle_save
using_backends = self.connection_router.for_write(instance=instance)
File "/usr/askbot-env/local/lib/python2.7/site-packages/haystack/utils/loading.py", line 140, in for_write
return self.for_action('for_write', **hints)
File "/usr/askbot-env/local/lib/python2.7/site-packages/haystack/utils/loading.py", line 132, in for_action
connection_to_use = action_callable(**hints)
File "/usr/askbot-env/local/lib/python2.7/site-packages/askbot-0.10.0-py2.7.egg/askbot/search/haystack/routers.py", line 20, in for_write
return get_alias()
File "/usr/askbot-env/local/lib/python2.7/site-packages/askbot-0.10.0-py2.7.egg/askbot/search/haystack/routers.py", line 9, in get_alias
language = get_language()
File "/usr/askbot-env/local/lib/python2.7/site-packages/askbot-0.10.0-py2.7.egg/askbot/search/haystack/utils.py", line 42, in get_language
return _get_language()[:2]
TypeError: 'NoneType' object has no attribute '__getitem__'
This seems to be related somehow to ASKBOT_LANGUAGE_MODE refactoring. The syncdb works well with single language setup, but haystack and multilang drops the exception above.
Which one do you installed version is, how to install it?