First time here? Check out the FAQ!
2

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

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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
thanhtut's avatar
1
thanhtut
asked 11 years ago

Comments

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

clemens's avatar clemens (11 years ago)

I have same issue with Askbot 0.7.48 and django 1.5.1

Mustafa's avatar Mustafa (11 years ago)

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

DmitryD's avatar DmitryD (11 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
DmitryD's avatar
1
DmitryD
answered 11 years ago
link

Comments

see more comments
0

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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 11 years ago
link

Comments

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

Mustafa's avatar Mustafa (11 years ago)

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

Mustafa's avatar Mustafa (11 years ago)

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 (11 years ago)

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 (11 years ago)
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 (11 years ago)
see more comments