Ask Your Question
0

UndefinedError: 'settings' is undefined

asked 2010-12-07 03:58:14 -0500

suyu8776 gravatar image

updated 2012-08-13 09:10:37 -0500

todofixthis gravatar image

In windows,i install askbot ,when i open http://localhost:8000 in chrome.I get these error.Would someone tell me the reson?

File "c:\python25\lib\site-packages\jinja2-2.5.5-py2.5.egg\jinja2\environment.py", line 371, in getattr

return getattr(obj, attribute)

UndefinedError: 'settings' is undefined

edit retag flag offensive close merge delete

Comments

Maybe you dont have the settings.py filled out correctly? The starting copy is in askbot/setup_templates or you can use "startforum" script that installs with askbot. I think what is missing is the askbot's template context processor, which injects that settings variable into the templates.
Evgeny gravatar imageEvgeny ( 2010-12-07 04:15:58 -0500 )edit
I downloaded a new version 0.6.41,and the problem has gone.But i found that there wasn't a whole database dump file(mysql),and i used "manage.py syncdb" script couldn't sync all tables; I hope there is a whole database dump file in the next version.
suyu8776 gravatar imagesuyu8776 ( 2010-12-09 01:04:07 -0500 )edit
Hey it's great that you've sorted this out. Now in addition to syncdb please run "python manage.py migrate" that will complete the database creation. It is actually described in the manual. There is a link "install/docs" above in the header. http://askbot.org/doc/index.html
Evgeny gravatar imageEvgeny ( 2010-12-09 01:16:24 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-08-13 08:15:36 -0500

NickJ gravatar image

I had the issue. The problem was I was missing the askbot context processor. Add this to your settings.py:

'askbot.user_messages.context_processors.user_messages', #must be before auth
edit flag offensive delete link more

Comments

I'm running askbot.noarch 0-.7.49-1.el6 (installed via yum on CentOS 6.5), my settings.py already has the entry mentioned, but I'm still getting the UndefinedError: 'settings' is undefined when trying to post a question to my site. Any thoughts? Is it correct that this context processor should be defined under the TEMPLATE_CONTEXT_PROCESSORS?

JohnB gravatar imageJohnB ( 2014-05-19 10:09:06 -0500 )edit
0

answered 2010-12-07 04:00:12 -0500

suyu8776 gravatar image

Traceback (most recent call last):

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\core\servers\basehttp.py", line 279, in run self.result = application(self.environ, self.start_response)

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\core\servers\basehttp.py", line 651, in __call__ return self.application(environ, start_response)

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\core\handlers\wsgi.py", line 241, in __call__ response = self.get_response(request)

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\core\handlers\base.py", line 141, in get_response return self.handle_uncaught_exception(request, resolver, exc_info)

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\core\handlers\base.py", line 180, in handle_uncaught_exception return callback(request, **param_dict)

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\views\defaults.py", line 24, in server_error return http.HttpResponseServerError(t.render(Context({})))

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\template__init__.py", line 165, in render return self.nodelist.render(context)

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\template__init__.py", line 784, in render bits.append(self.render_node(node, context))

File "c:\python25\lib\site-packages\django-1.1.2-py2.5.egg\django\template__init__.py", line 797, in render_node return node.render(context)

File "c:\python25\lib\site-packages\askbot-0.6.39-py2.5.egg\askbot\templatetags\extra_tags.py", line 125, in render return jinja_template.render(context)

File "c:\python25\lib\site-packages\coffin-0.3-py2.5.egg\coffin\template__init__.py", line 51, in render return super(Template, self).render(**context)

File "c:\python25\lib\site-packages\jinja2-2.5.5-py2.5.egg\jinja2\environment.py", line 891, in render return self.environment.handle_exception(exc_info, True)

File "C:\Python25\lib\site-packages\askbot-0.6.39-py2.5.egg\askbot\skins\default\templates\500.jinja.html", line 1, in top-level template code {% extends "two_column_body.html" %}

File "C:\Python25\lib\site-packages\askbot-0.6.39-py2.5.egg\askbot\skins\default\templates\two_column_body.html", line 1, in top-level template code {% extends "base.html" %}

File "C:\Python25\lib\site-packages\askbot-0.6.39-py2.5.egg\askbot\skins\default\templates\base.html", line 4, in top-level template code {% spaceless %}

File "c:\python25\lib\site-packages\coffin-0.3-py2.5.egg\coffin\template\defaulttags.py", line 348, in _strip_spaces return strip_spaces_between_tags(caller().strip())

File "C:\Python25\lib\site-packages\askbot-0.6.39-py2.5.egg\askbot\skins\default\templates\base.html", line 6, in template <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title>

File "c:\python25\lib\site-packages\jinja2-2.5.5-py2.5.egg\jinja2\environment.py", line 371, in getattr return getattr(obj, attribute)

UndefinedError: 'settings' is undefined

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2010-12-07 03:58:14 -0500

Seen: 1,811 times

Last updated: Aug 13 '12