First time here? Check out the FAQ!
2

Why do I need to run fix_revisionless_posts frequently?

  • retag add tags

We have recently set up an Askbot instance, which mostly works well, but frequently some questions appear to become corrupted, and I have to run manage.py fix_revisionless_posts to make that question work again.

Here is the output from running that command. I’m glad to provide whatever info you need to debug further.

root@help:/home/help# python manage.py fix_revisionless_posts WARNING!!! You are using a 'locmem' (local memory) caching backend, which is OK for a low volume site running on a single-process server. For a multi-process configuration it is neccessary to have a production cache system, such as redis or memcached.

With local memory caching and multi-process setup you might intermittently see outdated content on your site.

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. have 1 corrupted posts

mpearrow's avatar
21
mpearrow
asked 2016-03-08 09:03:29 -0500
edit flag offensive 0 remove flag close merge delete

Comments

What database are you using and what are the version of Django and Askbot you have?

Evgeny's avatar Evgeny (2016-03-09 05:22:25 -0500) edit

Django 1.8.10 and django.db.backends.postgresql_psycopg2 for database.

mpearrow's avatar mpearrow (2016-03-09 07:23:07 -0500) edit

A bit more information: here is the stack trace from the error (had to paste in an "answer" instead of a comment)

mpearrow's avatar mpearrow (2016-03-18 13:12:31 -0500) edit

@mpearrow have you resolved this? The missing revision occurs when there is some exception after the post is created and before revision is created.

Evgeny's avatar Evgeny (2016-06-15 06:09:44 -0500) edit
add a comment see more comments

1 Answer

0
Internal Server Error: /question/245/test-message-please-ignore/
Traceback (most recent call last):
 File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 132, in get_response
   response = wrapped_callback(request, *callback_args, **callback_kwargs)
 File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line 110, in _wrapped_view
   response = view_func(request, *args, **kwargs)
 File "/usr/local/lib/python2.7/dist-packages/askbot/views/readers.py", line 536, in question
   user=request.user
 File "/usr/local/lib/python2.7/dist-packages/askbot/models/question.py", line 1150, in get_post_data_for_question_view
   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", line 1235, in get_cached_post_data
   post_data = self.get_post_data(sort_method)
 File "/usr/local/lib/python2.7/dist-packages/askbot/models/question.py", line 1294, in get_post_data
   first_rev = post.get_earliest_revision()
 File "/usr/local/lib/python2.7/dist-packages/askbot/models/post.py", line 1601, in get_earliest_revision
   rev = self.revisions.order_by('revision')[0]
 File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 201, in __getitem__
   return list(qs)[0]
IndexError: list index out of range

I can re-create this error consistently by pasting the following into the body of the question and submitting:

Traceback (most recent call last):
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 139, in get_response
    response = response.render()
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/template/response.py", line 82, in rendered_content
    content = template.render(context)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/template/base.py", line 140, in render
    return self._render(context)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
    return self.nodelist.render(context)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/template/base.py", line 840, in render
    bit = self.render_node(node, context)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/template/base.py", line 854, in render_node
    return node.render(context)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/templatetags/static.py", line 106, in render
    url = self.url(context)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 12, in url
    return staticfiles_storage.url(path)
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 134, in url
    hashed_name = self.hashed_name(clean_name).replace('\\', '/')
  File "/home/deploy/.virtualenvs/toolbox/local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 91, in hashed_name
    (clean_name, self))
ValueError: The file 'components/ginkgo-breeze/jquery/dist/jquery.min.js' could not be found with <django.contrib.staticfiles.storage.CachedStaticFilesStorage object at 0x555a350>.
mpearrow's avatar
21
mpearrow
answered 2016-03-18 13:13:37 -0500, updated 2016-03-18 13:23:39 -0500
edit flag offensive 0 remove flag delete link

Comments

@mpearrow sorry for getting back late - what input should be posted to reproduce this? I could not understand that from your answer above. I was unable to reproduce the issue by posting a copy in the second pre-formatted sample. The code I've tested with is from the tip of the master branch at github.

Evgeny's avatar Evgeny (2016-06-15 06:10:57 -0500) edit
add a comment see more comments