How to prevent HTTP 304 in Django test server

Posted by Augusto Men on Stack Overflow See other posts from Stack Overflow or by Augusto Men
Published on 2010-04-28T14:20:04Z Indexed on 2010/04/28 14:23 UTC
Read the original article Hit count: 472

Filed under:
|
|
|

I have a couple of projects in Django and alternate between one and another every now and then. All of them have a /media/ path, which is served by django.views.static.serve, and they all have a /media/css/base.css file.

The problem is, whenever I run one project, the requests to base.css return an HTTP 304 (not modified), probably because the timestamp hasn't changed. But when I run the other project, the same 304 is returned, making the browser use the file cached by the previous project (and therefore, using the wrong stylesheet).

Just for the record, here are the middleware classes:

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.transaction.TransactionMiddleware',
)

I always use the default address http://localhost:8000. Is there another solution (other than using different ports - 8001, 8002, etc.)?

© Stack Overflow or respective owner

Related posts about django

Related posts about cache