Render the error page

def render_error_page(code, exc, mimetype='text/html', traceback=''):
    """
    Render the error page
    """
    from giotto.views import get_jinja_template

    if 'json' in mimetype:
        return json.dumps({
            'code': code,
            'exception': exc.__class__.__name__,
            'message': str(exc),
        })

    et = get_config('error_template')
    if not et:
        return "%s %s\n%s" % (code, str(exc), traceback)
    template = get_jinja_template(et)
    return template.render(
        code=code,
        exception=exc.__class__.__name__,
        message=str(exc),
        traceback=traceback
    )