caching - How to prevent HTTP 304 in Django test server -


i have couple of projects in django , alternate between 1 , every , then. of them have /media/ path, served django.views.static.serve, , have /media/css/base.css file.

the problem is, whenever run 1 project, requests base.css return http 304 (not modified), because timestamp hasn't changed. when run other project, same 304 returned, making browser use file cached previous project (and therefore, using wrong stylesheet).

just record, here middleware classes:

middleware_classes = (     'django.middleware.common.commonmiddleware',     'django.contrib.sessions.middleware.sessionmiddleware',     'django.contrib.auth.middleware.authenticationmiddleware',     'django.middleware.transaction.transactionmiddleware', ) 

i use default address http://localhost:8000. there solution (other using different ports - 8001, 8002, etc.)?

you can roll own middleware that:

class noifmodifiedsincemiddleware(object):     def process_request(self, request):         request.meta.pop('http_if_modified_since', none) 

basically, removes http_if_modified_since header request.

afterthought: or can monkeypatch django.views.static.serve , replace was_modified_since function one, returns true.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -