Copterfly / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

static files cache directives #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Django can serve static files using simple function that checks static file
modification time and sets appropriate headers:

{{{
#!python

statobj = os.stat(fullpath)
    if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),
                              statobj[stat.ST_MTIME], statobj[stat.ST_SIZE]):
        return HttpResponseNotModified()
    mimetype = mimetypes.guess_type(fullpath)[0]
    contents = open(fullpath, 'rb').read()
    response = HttpResponse(contents, mimetype=mimetype)
    response["Last-Modified"] = http_date(statobj[stat.ST_MTIME])
    return response
}}}

Can mod_wsgi do the same? Usual use case of mod_wsgi is to set it up to
serve static files while Django serves dynamic content. 

Regards,
Max.

Original issue reported on code.google.com by litnimax...@gmail.com on 8 Nov 2007 at 10:56

GoogleCodeExporter commented 9 years ago
Serving of static files is an Apache feature and not a part of mod_wsgi. How to 
serve static files is mentioned in 
'Hosting Of Static Files' of the ConfigurationGuidelines documentation. Serving 
of static media files for Django is 
also mentioned in IntegrationWithDjango and uses similar feature of Apache. 
Thus, see what directives are being 
used for serving static files and then check the Apache documentation at 
httpd.apache.org.

If still have questions, recommend using the mod_wsgi Google group to ask 
questions instead of doing it as a 
ticket.

Original comment by Graham.Dumpleton@gmail.com on 8 Nov 2007 at 11:02

GoogleCodeExporter commented 9 years ago
Thank you for quick response.
Sorry for creating new ticket.
I will use mailing list.
Also will see docs.
Please close it.

Regards,
Max.

Original comment by litnimax...@gmail.com on 8 Nov 2007 at 11:06

GoogleCodeExporter commented 9 years ago
Or better delete this ticket  at all :-)

Original comment by litnimax...@gmail.com on 8 Nov 2007 at 11:20

GoogleCodeExporter commented 9 years ago

Original comment by Graham.Dumpleton@gmail.com on 8 Nov 2007 at 11:24