First time here? Check out the FAQ!
1

How to resolve AttributeError upgrading to 0.9.x?

Have attempted to upgrade from 0.7.53 to 0.9.x and get the following error. The migrations have succeeded after some number of reattempts, rollbacks, server restores. The step through 0.8.2 was successful:

AttributeError at /questions/
'unicode' object has no attribute 'get'
Request Method: GET
Request URL:    http://xxx.com/questions/
Django Version: 1.7.11
Exception Type: AttributeError
Exception Value:    
'unicode' object has no attribute 'get'
Exception Location: /usr/local/lib/python2.7/dist-packages/askbot/models/__init__.py in user_get_avatar_url, line 236
Python Executable:  /usr/bin/python
Python Version: 2.7.12
Python Path:    
['/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/opt',
 '/opt/xxx',
 '/usr/local/lib/python2.7/dist-packages/askbot/deps']
Server time:    Wed, 29 Nov 2017 10:04:40 +0000

Debug:

Environment:

Request Method: GET
Request URL: http://xxx.com/questions/

Django Version: 1.7.11
Python Version: 2.7.12
Installed Applications:
('longerusername',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.humanize',
 'django.contrib.sitemaps',
 'django.contrib.messages',
 'askbot',
 'askbot.deps.django_authopenid',
 'askbot.deps.livesettings',
 'keyedcache',
 'robots',
 'django_countries',
 'djcelery',
 'djkombu',
 'followit',
 'tinymce',
 'askbot.deps.group_messaging',
 'compressor',
 'captcha')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
 'askbot.middleware.forum_mode.ForumModeMiddleware',
 'askbot.middleware.cancel.CancelActionMiddleware',
 'django.middleware.transaction.TransactionMiddleware',
 'askbot.middleware.view_log.ViewLogMiddleware',
 'askbot.middleware.spaceless.SpacelessMiddleware',
 'askbot.middleware.csrf.CsrfViewMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/askbot/views/readers.py" in questions
  287.         return render(request, 'main_page.html', template_data)
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py" in render
  50.     return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in render_to_string
  178.         return t.render(context_instance)
File "/usr/local/lib/python2.7/dist-packages/coffin/template/__init__.py" in render
  55.         return super(Template, self).render(**context)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py" in render
  989.         return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py" in handle_exception
  754.         reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/askbot/templates/main_page.html" in top-level template code
  2. {% import "macros.html" as macros %}
File "/usr/local/lib/python2.7/dist-packages/askbot/templates/two_column_body.html" in top-level template code
  1. {% extends "base.html" %}
File "/usr/local/lib/python2.7/dist-packages/askbot/templates/base.html" in top-level template code
  45.             {% block body %}
File "/usr/local/lib/python2.7/dist-packages/askbot/templates/two_column_body.html" in block "body"
  9.     {% block sidebar%}
File "/usr/local/lib/python2.7/dist-packages/askbot/templates/main_page.html" in block "sidebar"
  27.     {% include "main_page ...
(more)
Rupreck's avatar
305
Rupreck
asked 2017-11-29 04:22:00 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

The cause of this error is coding related to the JSONField type used for avatar_urls. Changes to __init__.py in askbot/models to comment out the assignment to that variable in 3 places permits the site to load. (lines 235,239 and 319 in the github master codebase and published releases 9 and 10 trigger the error.

Rupreck's avatar
305
Rupreck
answered 2017-12-10 12:49:21 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
-1

You are upgrading from 7.x branches to 9.x branches but keep in mind that both django versions are different for both the Askbot instances

When you upgrade AskBot, you should run given commands:

For version 9.x and 10.x

python manage.py makemigrations
python manage.py migrate

For version 7.x and 8.x

python manage.py syncdb
gopalraha's avatar
332
gopalraha
answered 2017-11-29 14:40:27 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks for the contribution but this is not the answer. These commands were run and the migration process succeeded.

Rupreck's avatar Rupreck (2017-11-29 22:19:26 -0500) edit

Provide more details including which stack you are using in which distro including complete details.

gopalraha's avatar gopalraha (2017-12-01 03:42:37 -0500) edit
add a comment see more comments