Django after migration UndefinedColumn error in production - django

I have a website in production. I have an app, with a model. It contained a markdown_file attribute:
markdown_file=models.FileField(upload_to='/media/')
But since the number of file is limited, I decided to make it a markdown_filename attribute with a choices selection box:
markdown_filename=models.CharField(max_length=30,null=True,blank=True,choices=MENU_MARKDOWN_FILE_CHOICES)
Therefore, I modified this model and made migrations locally. I pushed the code in production and run:
python manage.py migrate
After I checked with showmigrations and sqlmigrate, that the modification I made were there. Then, I checked in the database, that the fields were correctly modified. But, I still get this error, when trying to access the website:
ERROR:django.request:Internal Server Error: /
Traceback (most recent call last):
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedColumn: column showcase_subpage.markdown_file does not exist
LINE 1: ...bpage"."slug", "showcase_subpage"."html_content", "showcase_...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "./showcase/views.py", line 10, in home
return render(request, 'showcase/home.html', context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/shortcuts.py", line 36, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 937, in render
bit = node.render_annotated(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated
return self.render(context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/defaulttags.py", line 166, in render
len_values = len(values)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/query.py", line 256, in __len__
self._fetch_all()
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1100, in execute_sql
cursor.execute(sql, params)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column showcase_subpage.markdown_file does not exist
LINE 1: ...bpage"."slug", "showcase_subpage"."html_content", "showcase_...
^
The markdown_file field has been modified and renamed as markdown_filename. It has been correctly specified in the migrations. The modification is effective in the database. I tested locally (it works fine locally), to make sure, I don’t have anymore code calling markdown_file attribute.
I also tried clearing the migrations history and the database, to rebuilt it as new, but, the problem is still there. I can’t see why, this former attributes is still queried, though the migrations went OK, without any error.

Related

How to handle migrations in Django project in production (Digital Ocean App Platform)?

I have been using the app platform for almost 2 months. Yesterday, I made some changes in database tables (models) in my Django projects. I pushed those changes to Github and my app successfully redeployed. But When I open the site, I got “ProgrammingError” that some field that I created new in the existing table does not exist. So, I opened the console in App Platform and applied migrations but nothing is changed. I am still facing the error.
Here is the full traceback:
Traceback (most recent call last):
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
The above exception (column products_subcategory.description does not exist
LINE 1: ...subcategory"."id", "products_subcategory"."name", "products_...
^
) was the direct cause of the following exception:
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/workspace/lavisco/views.py", line 40, in get
return render(request, 'lavisco/index.html', context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 170, in render
return self._render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/loader_tags.py", line 192, in render
return template.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 172, in render
return self._render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 162, in _render
return self.nodelist.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 938, in render
bit = node.render_annotated(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/base.py", line 905, in render_annotated
return self.render(context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/template/defaulttags.py", line 311, in render
if match:
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 291, in bool
self._fetch_all()
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 1308, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py", line 53, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql
cursor.execute(sql, params)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/workspace/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
Exception Type: ProgrammingError at /
Exception Value: column products_subcategory.description does not exist
LINE 1: ...subcategory"."id", "products_subcategory"."name", "products_...

Django catch missing manifest exceptions

Every now and then I end up with a missing file after deploy a django project, and I find it one of the hardest issues to debug because I get no logging and no error email, its just dead. I have made a custom 500 error page (followed this answer). Is it possible to show the details of which static file is missing on it? With this error Django fails before rendering a 500 page.
Heres a traceback of the error:
Traceback (most recent call last):
File "/usr/lib/python3.8/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/user/venv/project/lib/python3.8/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
response = self.get_response(request)
File "/home/user/venv/project/lib/python3.8/site-packages/django/core/handlers/base.py", line 75, in get_response
response = self._middleware_chain(request)
File "/home/user/venv/project/lib/python3.8/site-packages/django/core/handlers/exception.py", line 36, in inner
response = response_for_exception(request, exc)
File "/home/user/venv/project/lib/python3.8/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/home/user/venv/project/lib/python3.8/site-packages/django/core/handlers/exception.py", line 129, in handle_uncaught_exception
return callback(request, **param_dict)
File "/home/user/project/src/core/base/views.py", line 236, in error_500_view
response = render(request, "core.base/500.html", context=context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/loader.py", line 62, in render_to_string
return template.render(context, request)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/test/utils.py", line 95, in instrumented_test_render
return self.nodelist.render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/test/utils.py", line 95, in instrumented_test_render
return self.nodelist.render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/templatetags/static.py", line 106, in render
url = self.url(context)
File "/home/user/venv/project/lib/python3.8/site-packages/django/templatetags/static.py", line 103, in url
return self.handle_simple(path)
File "/home/user/venv/project/lib/python3.8/site-packages/django/templatetags/static.py", line 118, in handle_simple
return staticfiles_storage.url(path)
File "/home/user/venv/project/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 153, in url
return self._url(self.stored_name, name, force)
File "/home/user/venv/project/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 132, in _url
hashed_name = hashed_name_func(*args)
File "/home/user/venv/project/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 423, in stored_name
raise ValueError("Missing staticfiles manifest entry for '%s'" % clean_name)
ValueError: Missing staticfiles manifest entry for 'img/pwa/browserconfig.xml'

Django Celery with Johnny Cache tasks failing with weird errors

I am running Django 1.4.5, Celery 3.0.15, Django Celery 3.0.11, Johnny Cache 1.4.
The calls to ORM in celery tasks sometimes fail with weird errors like invalid literal for int() with base 10: 'a'" or <MaybeEncodingError: Error sending result: ''<ExceptionInfo: ObjectDoesNotExist()>''. Reason: ''PicklingError("Can\'t pickle <class \'scsite.models.DoesNotExist\'>: attribute lookup scsite.models.DoesNotExist failed",)''.>:
Here is a sample stack trace:
Task scsite.tasks.send_signup_email[aecf0561-65af-4d11-a3a0-63d88b7e1a70] raised exception: ValueError("invalid literal for int() with base 10: 'd'",)
Task scsite.tasks.send_signup_email[aecf0561-65af-4d11-a3a0-63d88b7e1a70] raised exception: ValueError("invalid literal for int() with base 10: 'd'",)
Stacktrace (most recent call last):
File "celery/execute/trace.py", line 192, in trace_task
R = I.handle_error_state(task, eager=eager)
File "scsite/tasks.py", line 537, in send_signup_email
email_html = email_template.render(Context(data))
File "django/template/base.py", line 142, in render
context.render_context.pop()
File "django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "django/template/base.py", line 837, in render_node
return node.render(context)
File "django/template/loader_tags.py", line 155, in render
return self.render_template(self.template, context)
File "django/template/loader_tags.py", line 137, in render_template
output = template.render(context)
File "django/template/base.py", line 142, in render
context.render_context.pop()
File "django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "django/template/base.py", line 837, in render_node
return node.render(context)
File "django/template/defaulttags.py", line 192, in render
nodelist.append(node.render(context))
File "django/template/defaulttags.py", line 474, in render
self.extra_context.iteritems()])
File "django/template/base.py", line 584, in resolve
obj = settings.TEMPLATE_STRING_IF_INVALID
File "django/template/base.py", line 721, in resolve
value = self._resolve_lookup(context)
File "django/template/base.py", line 781, in _resolve_lookup
raise
File "django/db/models/manager.py", line 119, in count
return self.get_query_set().count()
File "django/db/models/fields/related.py", line 461, in get_query_set
return super(RelatedManager, self).get_query_set().using(db).filter(**self.core_filters)
File "django/db/models/query.py", line 624, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "django/db/models/query.py", line 642, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "django/db/models/sql/query.py", line 1250, in add_q
can_reuse=used_aliases, force_having=force_having)
File "django/db/models/sql/query.py", line 1185, in add_filter
connector)
File "django/db/models/sql/where.py", line 69, in add
value = obj.prepare(lookup_type, value)
File "django/db/models/sql/where.py", line 320, in prepare
return self.field.get_prep_lookup(lookup_type, value)
File "django/db/models/fields/__init__.py", line 310, in get_prep_lookup
return self.get_prep_value(value)
File "django/db/models/fields/__init__.py", line 537, in get_prep_value
return int(value)
Task scsite.tasks.update_various_denorm_fields[edddb260-041d-4195-83d7-f2e731e5d1a5] raised exception: ValueError("invalid literal for int() with base 10: 'a'",)
Stacktrace (most recent call last):
File "celery/task/trace.py", line 242, in trace_task
R = I.handle_error_state(task, eager=eager)
File "celery/task/trace.py", line 415, in __protected_call__
return self.run(*args, **kwargs)
File "scsite/tasks.py", line 470, in update_various_denorm_fields
Person.objects.update_question_counts()
File "scsite/managers.py", line 715, in update_question_counts
person.update_question_count_denorm()
File "scsite/models.py", line 2712, in update_question_count_denorm
self.question_count_denorm = self.questions.count()
File "django/db/models/manager.py", line 119, in count
return self.get_query_set().count()
File "django/db/models/fields/related.py", line 567, in get_query_set
return super(ManyRelatedManager, self).get_query_set().using(db)._next_is_sticky().filter(**self.core_filters)
File "django/db/models/query.py", line 624, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "django/db/models/query.py", line 642, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "django/db/models/sql/query.py", line 1250, in add_q
can_reuse=used_aliases, force_having=force_having)
File "django/db/models/sql/query.py", line 1185, in add_filter
connector)
File "django/db/models/sql/where.py", line 69, in add
value = obj.prepare(lookup_type, value)
File "django/db/models/sql/where.py", line 320, in prepare
return self.field.get_prep_lookup(lookup_type, value)
File "django/db/models/fields/__init__.py", line 310, in get_prep_lookup
return self.get_prep_value(value)
File "django/db/models/fields/__init__.py", line 537, in get_prep_value
return int(value)
I believe the error is not in my code, it looks like cache becomes corrupt for some reason, and something like the following happens:
CustomModel with pk=123 is retrieved.
It is passed on to Celery to process.
For some reason, the pk of the Custom model becomes a character like 'a', 'd' instead of 123. Another call is made with MyModel.objects.get(pk='a') and it obviously fails.
Actually, revisiting the code for this, it seems I am not passing an object to Celery as I mentioned above, just running the following manager method from a simple celery task.
#task
def mytask():
Person.objects.update_question_count()
class PersonManager(models.Manager):
def update_question_counts(self):
persons = self.all() # 1
for person in persons:
person.update_question_count_denorm() #3
My guess is the following: when Line 1 runs, persons is obtained from cache, but while processing line 3, the cache obtained in Line 1 becomes corrupt.

Django Haystack random errors using Whoosh

I am using django-haystack and Whoosh on my Ubuntu server and finding that certain search queries just raise an error page, and I have no idea why this is happening...
I am using the following ones
Whoosh==2.4.0
django-haystack==1.2.7
And I also run python manage.py update_index once every hour
Example traceback
Traceback (most recent call last):
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/newrelic-1.2.0.246/newrelic/hooks/framework_django.py", line 430, in __call__
return self.__wrapped(*args, **kwargs)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/haystack/views.py", line 50, in __call__
return self.create_response()
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/haystack/views.py", line 145, in create_response
return render_to_response(self.template, context, context_instance=self.context_class(self.request))
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/shortcuts/__init__.py", line 20, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/loader.py", line 188, in render_to_string
return t.render(context_instance)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 123, in render
return self._render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/newrelic-1.2.0.246/newrelic/api/function_trace.py", line 82, in __call__
return self._nr_next_object(*args, **kwargs)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 117, in _render
return self.nodelist.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
bits.append(self.render_node(node, context))
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 757, in render_node
return node.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 127, in render
return compiled_parent._render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/newrelic-1.2.0.246/newrelic/api/function_trace.py", line 82, in __call__
return self._nr_next_object(*args, **kwargs)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 117, in _render
return self.nodelist.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
bits.append(self.render_node(node, context))
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 757, in render_node
return node.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/newrelic-1.2.0.246/newrelic/hooks/framework_django.py", line 622, in __call__
return self.__wrapped(*args, **kwargs)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/loader_tags.py", line 64, in render
result = block.nodelist.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
bits.append(self.render_node(node, context))
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 757, in render_node
return node.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 311, in render
return self.nodelist_true.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
bits.append(self.render_node(node, context))
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 757, in render_node
return node.render(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/defaulttags.py", line 227, in render
nodelist.append(node.render(context))
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 915, in render
resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 653, in resolve
value = self._resolve_lookup(context)
File "/home/fundedbyme/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/django/template/base.py", line 692, in _resolve_lookup
raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute
VariableDoesNotExist: Failed lookup for key [object] in u'None'
<WSGIRequest
GET:<QueryDict: {u'q': [u'stockholm']}>,
Could you please put here your view and your template code? If this is happening with just some queries and not all of them, it could be the parameters you are passing to the view.
Here's the code of the view I'm using to make search queries using Haystack 2.0 and Whoosh 2.3.2 in a project of my own:
def search(request):
sqs = SearchQuerySet().filter(content=AutoQuery(request.GET['q']))
return render_to_response('search.html', {'sqs': sqs,})
and this works perfectly fine. I guess you should consider using the latest version of Haystack, because I was experiencing a lot of bugs with the old stable ones. And I recommend you to use the "rebuild_index" once in a while too, just in case.

Django Exception NoReverseMatch for an app not installed (anymore)

I was develping a site and once installed django-bb, but at some point i've decided not to use anymore, so i "turned-off" django-bb commenting all reference code. So far all good. On my dev machine everting runs ok. But on the server machine, something is calling for djangobb. I tried to delete all files relatives to djangobb, and it's no way i can get rid of this exception error. And I've checked all my html code and cant find anyware this call for djangobb.
Please anybody can help?
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 280, in run
self.result = application(self.environ, self.start_response)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 674, in __call__
return self.application(environ, start_response)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 248, in __call__
response = self.get_response(request)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/core/handlers/base.py", line 130, in get_response
return self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/core/handlers/base.py", line 180, in handle_uncaught_exception
return callback(request, **param_dict)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/utils/decorators.py", line 76, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/views/defaults.py", line 31, in server_error
return http.HttpResponseServerError(t.render(Context({})))
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/template/__init__.py", line 173, in render
return self._render(context)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/template/__init__.py", line 167, in _render
return self.nodelist.render(context)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/template/__init__.py", line 796, in render
bits.append(self.render_node(node, context))
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/template/__init__.py", line 809, in render_node
return node.render(context)
File "/root/Envs/PolyAssocEnv/lib/python2.6/site-packages/django/template/defaulttags.py", line 385, in render
raise e
NoReverseMatch: u'djangobb' is not a registered namespace