First time here? Check out the FAQ!
2

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

  • retag add tags

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
thanhtut's avatar
1
thanhtut
asked 2013-06-27 23:24:36 -0500
edit flag offensive 0 remove flag close merge delete

Comments

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

clemens's avatar clemens (2013-07-29 04:43:07 -0500) edit

I have same issue with Askbot 0.7.48 and django 1.5.1

Mustafa's avatar Mustafa (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's avatar DmitryD (2013-08-19 06:11:27 -0500) edit
add a comment see more comments

2 Answers

2

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.

DmitryD's avatar
1
DmitryD
answered 2013-08-19 07:36:11 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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

Evgeny's avatar
13.2k
Evgeny
answered 2013-08-10 20:16:23 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Mustafa's avatar Mustafa (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's avatar Mustafa (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's avatar thanhtut (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's avatar Mustafa (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's avatar Evgeny (2013-08-11 17:18:56 -0500) edit
add a comment see more comments