Error while live editing a django template on linode
File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py", line 108, in __init__
self.nodelist = compile_string(template_string, origin)
File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py", line 136, in compile_string
return parser.parse()
File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py", line 237, in parse
self.invalid_block_tag(token, command, parse_until)
File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py", line 291, in invalid_block_tag
raise self.error(token, "Invalid block tag: '%s'" % command)
TemplateSyntaxError: Invalid block tag: '%20get_static_prefix%20'
And tail -f of error.log shows:
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] return callback(request, **param_dict), referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/utils/decorators.py", line 93, in _wrapped_view, referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] response = view_func(request, *args, **kwargs), referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/views/defaults.py", line 30, in server_error, referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] t = loader.get_template(template_name) # You need to create a 500.html template., referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/loader.py", line 157, in get_template, referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] template, origin = find_template(template_name), referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/loader.py", line 138, in find_template, referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] raise TemplateDoesNotExist(name), referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121] TemplateDoesNotExist: 500.html, referer: http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6799748107
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] mod_wsgi (pid=2688): Exception occurred processing WSGI script '/home/jalala/projects/Hamkharid/bin/django.wsgi'.
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] Traceback (most recent call last):
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/core/handlers/wsgi.py", line 272, in __call__
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] response = self.get_response(request)
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/core/handlers/base.py", line 169, in get_response
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/core/handlers/base.py", line 218, in handle_uncaught_exception
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] return callback(request, **param_dict)
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/utils/decorators.py", line 93, in _wrapped_view
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] response = view_func(request, *args, **kwargs)
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/views/defaults.py", line 30, in server_error
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] t = loader.get_template(template_name) # You need to create a 500.html template.
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/loader.py", line 157, in get_template
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] template, origin = find_template(template_name)
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] File "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/loader.py", line 138, in find_template
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] raise TemplateDoesNotExist(name)
[Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] TemplateDoesNotExist: 500.html
Is there anything I can do now? sorry but this is very urgent for me so your kind helps will be very appreciated.
Thanks,
1 Reply
1) There is no 500.html template
2) Whatever template it is trying to render has an invalid block tag… grep around your templates for "getstaticprefix" and make sure nothing has any %20 junk around it. Note that Django caches things rather aggressively, so you'll probably have to restart Django if you've fixed the problem. Also, base.py isn't a template and probably shouldn't be edited unless you're actively developing Django.
If worse comes to worse, set DEBUG=True and TEMPLATE_DEBUG=True in your settings.py and it will show you exactly where the problem is.