<commit_before>from django.http import HttpResponse

def sendfile(request, filename):
    response = HttpResponse('')
    print filename
    response['Location'] = filename
    return response
<commit_msg>Not quite there with wsgi backend yet<commit_after>from django.http import HttpResponse

from django.conf import settings
import os.path

def _convert_file_to_url(filename):
    # CURRENTLY NOT WORKING
    # mod_wsgi wants a relative URL not a filename
    # so apache does an internal redirect

    relpath = os.path.relpath(filename, settings.SENDFILE_ROOT)
    
    url = [settings.SENDFILE_URL]

    while relpath:
        print relpath
        relpath, head = os.path.split(relpath)
        url.insert(1, head)

    return u''.join(url)

def sendfile(request, filename):
    response = HttpResponse()
    response['Location'] = _convert_file_to_url(filename)

    return response

{'fraction_non_alphanumeric': 0.07977528089887641, 'fraction_numerical': 0.0011235955056179776, 'mean_word_length': 3.6649214659685865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3686953', 'n_tokens_mistral': 265, 'n_tokens_neox': 255, 'n_words': 75}