First time here? Check out the FAQ!
1

How to fix "UndefinedError: 'settings' is undefined" in git branch

Hi,

I am trying the git branch and I got the following error. Does anyone has any clue of what might go wrong ... or what should I do to fix it. The version installed using pip is working.

I have upgrade askbot based on this information: http://askbot.org/en/question/310/how-do-you-manage-askbot-and-upgrades

It looks like it is related to the database upgrade... droping all tables and recreating the database solved this problem...

    Traceback (most recent call last):
  File "passenger_wsgi.py", line 22, in application
    return application(environ, start_response)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
    response = self.get_response(request)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/handlers/base.py", line 141, in get_response
    return self.handle_uncaught_exception(request, resolver, exc_info)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/handlers/base.py", line 180, in handle_uncaught_exception
    return callback(request, **param_dict)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/views/defaults.py", line 24, in server_error
    return http.HttpResponseServerError(t.render(Context({})))
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/template/__init__.py", line 165, in render
    return self.nodelist.render(context)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/template/__init__.py", line 784, in render
    bits.append(self.render_node(node, context))
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/template/__init__.py", line 797, in render_node
    return node.render(context)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/askbot/templatetags/extra_tags.py", line 124, in render
    return jinja_template.render(context)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/coffin/template/__init__.py", line 51, in render
    return super(Template, self).render(**context)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/jinja2/environment.py", line 891, in render
    return self.environment.handle_exception(exc_info, True)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/askbot/skins/default/templates/500.jinja.html", line 1, in top-level template code
    {% extends "two_column_body.html" %}
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/askbot/skins/default/templates/two_column_body.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/askbot/skins/default/templates/base.html", line 4, in top-level template code
    {% spaceless %}
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/coffin/template/defaulttags.py", line 348, in _strip_spaces
    return strip_spaces_between_tags(caller().strip())
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/askbot/skins/default/templates/base.html", line 6, in template
    <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title>
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/jinja2/environment.py", line 371, in getattr
    return getattr(obj, attribute)
Adi Roiban's avatar
67
Adi Roiban
updated 2011-03-06 07:57:15 -0500, asked 2011-03-06 07:41:15 -0500
edit flag offensive 0 remove flag close merge delete

Comments

Which version of django are you using? Were there any other changes other than the database re-creation between the failed and the successful run?
Evgeny's avatar Evgeny (2011-03-06 20:20:58 -0500) edit
Sometimes tracebacks from jinja2 templates are not very helpful. If in the settings.py you change DEBUG = True, TEMPLATE_DEBUG = False, the messages become more meaningful. That is probably the worst inconvenience of Jinja templates, other than that I like them much more than standard django templates.
Evgeny's avatar Evgeny (2011-03-06 20:37:17 -0500) edit

Previous comment is true. I had the same traceback and when enabling the debug mode in settings.py it revealed another problem. See http://askbot.org/en/question/9815/database-integrityerror-in-admin/

Fabien Meghazi's avatar Fabien Meghazi (2013-01-17 18:05:14 -0500) edit

Previous comment is true. I had the same traceback and when enabling the debug mode in settings.py it revealed another problem. See http://askbot.org/en/question/9815/database-integrityerror-in-admin/

Fabien Meghazi's avatar Fabien Meghazi (2013-01-17 18:05:15 -0500) edit
add a comment see more comments

1 Answer

0

Maybe you forgot to migrate the database?

python manage.py migrate askbot
Evgeny's avatar
13.2k
Evgeny
updated 2011-03-06 12:27:39 -0500, answered 2011-03-06 12:25:47 -0500
edit flag offensive 0 remove flag delete link

Comments

Uh... Thanks for the answer. I only did `python manage.py migrate` as in your other answer there was no notes about `python manage.py migrate askbot`
Adi Roiban's avatar Adi Roiban (2011-03-06 18:34:23 -0500) edit
Well, your command actually does migrate askbot as well any other django apps that use South system for the database migrations. The origin of this error is not clear to me... It does not seem to be a migration issue, since you've said you have done it.
Evgeny's avatar Evgeny (2011-03-06 20:18:15 -0500) edit
add a comment see more comments