def base_info(request, version = None):
    optimade_request = _django_request_to_optimade_request(request)
    try:
        output = optimade.process(optimade_request, backend.execute_query, debug=True)
        response = JsonResponse(output, safe=False,content_type='application/vnd.api+json',json_dumps_params=json_dumps_params)
        return response
    except optimade.OptimadeError as e:
        error = JsonapiError("Could not process request: "+str(e),e.response_code,e.response_msg)
        return JsonResponse(error.content_json, safe=False,content_type='application/vnd.api+json', status=error.response_code,json_dumps_params=json_dumps_params)
def request_callback(request):

    webserver.check_jsonapi_header_requirements(request['headers'])
    
    try:
        response = optimade.process(request, backend.execute_query, debug = True)
    except optimade.OptimadeError as e:
        raise webserver.JsonapiError("Could not process request: "+str(e),e.response_code,e.response_msg)
    
    return {'content': _json_format(response), 'content_type':'application/vnd.api+json', 'response_code':200, 'response_msg':'OK', 'encoding':'utf-8'}
def app(environ, start_response):

    request = webserver.wsgi_get_request(environ)

    try:
        webserver.check_jsonapi_header_requirements(request['headers'])
        response = optimade.process(request, backend.execute_query, debug=True)
    except (optimade.OptimadeError, webserver.WebError) as e:
        error = webserver.JsonapiError("Could not process request: " + str(e),
                                       e.response_code, e.response_msg)
        start_response(
            str(error.response_code) + " " + str(error.response_msg),
            [('Content-Type', error.content_type)])
        return [codecs.encode(error.content, 'utf-8')]

    start_response('200 OK', [('Content-Type', 'application/vnd.api+json')])
    return [_json_format(response)]