Ask Your Question
0

Server runs for some minutes and then 500 error

asked 2013-12-13 12:48:22 -0600

nicanorl gravatar image

updated 2013-12-14 07:10:26 -0600

Hi,

I'm running apache2 with wsgi. I've put the website for production yesterday and It was running fine, but now it just sends a 500 error. Restarting apache doesn't seem to solve the issue. This is the error I'm receiving:

 [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
 mod_wsgi (pid=27861): Exception occurred processing WSGI script '/var/www/example/django.wsgi'.
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 255, in __call__
     response = self.get_response(request)
   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 178, in get_response
     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
   File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 224, in handle_uncaught_exception
     return callback(request, **param_dict)
   File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line 91, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "/usr/local/lib/python2.7/dist-packages/django/views/defaults.py", line 41, in server_error
     return http.HttpResponseServerError(template.render(Context({})))
   File "/usr/local/lib/python2.7/dist-packages/coffin/template/__init__.py", line 55, in render
     return super(Template, self).render(**context)
   File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 969, in render
     return self.environment.handle_exception(exc_info, True)
   File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 742, in handle_exception
     reraise(exc_type, exc_value, tb)
   File "/usr/local/lib/python2.7/dist-packages/askbot/templates/500.html", line 1, in top-level template code
     {% extends "two_column_body.html" %}
   File "/usr/local/lib/python2.7/dist-packages/askbot/templates/two_column_body.html", line 1, in top-level template code
     {% extends "base.html" %}
   File "/usr/local/lib/python2.7/dist-packages/askbot/templates/base.html", line 5, in top-level template code
     <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title>
   File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 397, in getattr
     return getattr(obj, attribute)
 UndefinedError: 'settings' is undefined

I'm running in production mode.

Thanks !

Edit: I discovered that the command touch django.wsgi solves the issue for some minutes. Then the error arises again.

Edit2: Sometimes, when a 500 error arises, reloading the page solves the issue. But visiting any other page will cause the 500 error again, until you reload the page again.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-12-15 09:54:50 -0600

odyssey gravatar image

updated 2013-12-15 09:59:31 -0600

Create a static robots.txt file served by apache, I observed that when a request for robots.txt hits django an exception is thrown and the app does not go back working normally afterwards. I did not dig into what generates this error but doing this solves it.

edit flag offensive delete link more

Comments

Thanks a lot for your help!! I can confirm that "when a request for robots.txt hits django an exception is thrown and the app does not go back working normally afterwards." But I found no way to add a robots.txt file, I will keep trying tomorrow.

nicanorl gravatar imagenicanorl ( 2013-12-15 12:20:43 -0600 )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

2 followers

Stats

Asked: 2013-12-13 12:48:22 -0600

Seen: 629 times

Last updated: Dec 15 '13