Ask Your Question
2

Strange error in Deploying with Apache + WSGI and Debug = False

asked 2013-06-27 23:24:36 -0500

thanhtut gravatar image

Can anyone here help me fix the error. I am deploying Askbot using Apache + WSGI. Everything works well until I set Debug = False.

If there's any tips to solve that it would be very helpful. I think I may be configuring it wrong.

    [Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     return http.HttpResponseServerError(t.render(Context({})))
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/deployenv/local/lib/python2.7/site-packages/Coffin-0.3.7-py2.7.egg/coffin/template/__init__.py", line 55, in render
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     return super(Template, self).render(**context)
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/deployenv/local/lib/python2.7/site-packages/Jinja2-2.7-py2.7.egg/jinja2/environment.py", line 969, in render
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     return self.environment.handle_exception(exc_info, True)
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/deployenv/local/lib/python2.7/site-packages/Jinja2-2.7-py2.7.egg/jinja2/environment.py", line 742, in handle_exception
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     reraise(exc_type, exc_value, tb)
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/askbot/templates/500.html", line 1, in top-level template code
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     {% extends "two_column_body.html" %}
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/askbot/templates/two_column_body.html", line 1, in top-level template code
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     {% extends "base.html" %}
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/askbot/templates/base.html", line 5, in top-level template code
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title>
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]   File "/home/ubuntu/deploy-ipst-collaborative-learning/deployenv/local/lib/python2.7/site-packages/Jinja2-2.7-py2.7.egg/jinja2/environment.py", line 397, in getattr
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114]     return getattr(obj, attribute)
[Fri Jun 28 11:12:40 2013] [error] [client 203.131.208.114] UndefinedError: 'settings' is undefined
edit retag flag offensive close merge delete

Comments

I encounter the same error. Fresh install of askbot. Django 1.4.2 Postgres 8.4 Python 2.6

clemens gravatar imageclemens ( 2013-07-29 04:43:07 -0500 )edit

I have same issue with Askbot 0.7.48 and django 1.5.1

Mustafa gravatar imageMustafa ( 2013-08-10 17:37:49 -0500 )edit

I have the same, there is no errors when DEBUG=True Did anybody managed to solve this issue?

DmitryD gravatar imageDmitryD ( 2013-08-19 06:11:27 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-08-19 07:36:11 -0500

DmitryD gravatar image

Well, got it. If DEBUG=True 'askbot.context.application_settings' not loaded. It's caused by missed https://docs.djangoproject.com/en/1.5/ref/settings/#std:setting-ALLOWED_HOSTS (ALLOWED_HOSTS) setting.

Having correct ALLOWED_HOSTS fixes issue.

edit flag offensive delete link more
0

answered 2013-08-10 20:16:23 -0500

Evgeny gravatar image

This error conceals some other, enable DEBUG=True to see the underlying cause.

edit flag offensive delete link more

Comments

there is no errors when [ DEBUG=True ] if I use runserver or apache/wsgi

Mustafa gravatar imageMustafa ( 2013-08-11 05:51:50 -0500 )edit

I solve it by disabling the develop mode, I found that with develop mode I can't disable debug mode!

Mustafa gravatar imageMustafa ( 2013-08-11 13:41:17 -0500 )edit

I also happen to solve this problem by enabling the debug mode. It seems to be a caching issue when the debug mode is turned off.

thanhtut gravatar imagethanhtut ( 2013-08-11 13:47:47 -0500 )edit

Are you using [CACHE_BACKEND = 'locmem://'] if yes, please use local file caching it's better , and if possible switch to memcached it's the best for more see https://docs.djangoproject.com/en/1.1/topics/cache/

Mustafa gravatar imageMustafa ( 2013-08-11 17:02:37 -0500 )edit
1

We are going to switch to the Filesystem cache backend to use by default, locmem causes too many problems to the new users.

Evgeny gravatar imageEvgeny ( 2013-08-11 17:18:56 -0500 )edit

Your Answer

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

Add Answer

Question Tools

4 followers

Stats

Asked: 2013-06-27 23:24:36 -0500

Seen: 351 times

Last updated: Aug 19 '13