First time here? Check out the FAQ!
0

What causes Internal server error on accessing some questions?
 

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

Upgrade steps:

pip install --upgrade askbot
python manage.py migrate --list    
python manage.py migrate
python manage.py syncdb --migrate
python manage.py collectstatic

plus:

python manage.py 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:
('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',
 'askbot',
 'askbot.deps.django_authopenid',
 'south',
 'askbot.deps.livesettings',
 'keyedcache',
 'robots',
 'django_countries',
 'djcelery',
 'djkombu',
 'followit',
 'tinymce',
 'group_messaging',
 'compressor',
 'django.contrib.messages')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 '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',
 'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  113.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/askbot/views/readers.py" in question
  513.                                 user=request.user
File "/usr/local/lib/python2.7/dist-packages/askbot/models/question.py" 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/question.py" in get_cached_post_data
  1195.             post_data = self.get_post_data(sort_method)
File "/usr/local/lib/python2.7/dist-packages/askbot/models/question.py" in get_post_data
  1245.             first_rev = post.get_earliest_revision()
File "/usr/local/lib/python2.7/dist-packages/askbot/models/post.py" in get_earliest_revision
  1506.         rev = self.revisions.order_by('revision')[0]
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" 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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Rupreck's avatar
305
Rupreck
asked 10 years ago

Comments

see more comments

1 Answer

1

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

python manage.py 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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 10 years ago, updated 10 years ago
link

Comments

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's avatar Rupreck (10 years ago)

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's avatar Evgeny (10 years ago)

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's avatar Rupreck (10 years ago)
see more comments