Ask Your Question

What causes Internal server error on accessing some questions?

asked 2015-02-13 11:06:20 -0600

Rupreck gravatar image

After upgrading to 0.7.50 we get and internal server error on loading some questions:

Upgrade steps:

pip install --upgrade askbot
python migrate --list    
python migrate
python syncdb --migrate
python collectstatic


python generate_post_snippets

The error

    list index out of range
    Request Method: GET
Django Version: 1.5.12
Python Version: 2.7.6
Installed Applications:
Installed Middleware:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/" in get_response
  113.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/askbot/views/" in question
  513.                                 user=request.user
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_post_data_for_question_view
  1087.         post_data = self.get_cached_post_data(user=user, sort_method=sort_method)
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_cached_post_data
  1195.             post_data = self.get_post_data(sort_method)
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_post_data
  1245.             first_rev = post.get_earliest_revision()
File "/usr/local/lib/python2.7/dist-packages/askbot/models/" in get_earliest_revision
  1506.         rev = self.revisions.order_by('revision')[0]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/" in __getitem__
  231.             return list(qs)[0]

Exception Type: IndexError at /question/198/from-windows-xp-to-windows-7/
Exception Value: list index out of range
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-13 12:11:14 -0600

Evgeny gravatar image

updated 2015-02-13 12:32:21 -0600

Looks like you have data corruption, to fix this specific error, run command:

python fix_revisionless_posts

There is a number of other commands that start with either fix_ or askbot_fix_

To see the list of commands, please look into directory askbot/management/commands.

edit flag offensive delete link more


Fixed. Thank-you very much for your help! This made 28 edits appear into the moderation queue. However selecting them and clicking either of the approve buttons failed until the 1st user was changed to 'Approved' within his Profile page. I am not sure why it didn't do that using the moderation button for users and posts. Please can you point me to where I can see the list of fix_ and askbot_fix_ commands?

Rupreck gravatar imageRupreck ( 2015-02-13 12:25:32 -0600 )edit

Possibly the fix command needs to be updated to temporarily disable the content moderation during the command execution. On the other hand you could disable the content moderation manually and then run the command.

Evgeny gravatar imageEvgeny ( 2015-02-13 12:39:36 -0600 )edit

Thanks. After the change to the 1st user, the button worked for the rest. Site is working very well now. Thank-you for your continuing efforts with askbot, it really is a great piece of work.

Rupreck gravatar imageRupreck ( 2015-02-13 12:50:11 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2015-02-13 11:06:20 -0600

Seen: 2,110 times

Last updated: Feb 13 '15