Question: I can generate html from a file on the fly and return like this:

```
from django.http import HttpResponse
response = HttpResponse(mimetype="text/html")
content = "".join(open(filename).readlines())
response._set_content(content)
return response

```

but is there a better, built in way, in Django 1.5?

Answer: 
The following code is a better method for making a file available for download or viewing, short of streaming (which has some downsides, such as not having a known size).

```
from django.http import HttpResponse
def serve_file(filename):
    response = HttpResponse(mimetype="text/html")
    for line in open(filename):
        response.write(line)
    return response

```
You should configure your webserver to [serve static files](https://docs.djangoproject.com/en/1.5/howto/static-files/deployment/) directly. 

If you absolutely have to do it through django you could use [static views](https://docs.djangoproject.com/en/1.5/howto/static-files/).