CSS not updating on local httpserver python restart

I am new to the world of web developers and http servers and the like, but I have a basic shell script like this:

PORT=2600 if [[ $1 =~ ^[0-9]+$ ]] then PORT=$1 fi echo "Starting local http server (ctrl-c to exit)" echo "" echo " Demo: http://127.0.0.1:$PORT/demo" echo "" python -m SimpleHTTPServer $PORT 

Everything seems to be working fine, but when I update the css file in my demo, it rarely and inconsistently updates the css displayed on the page. Changes in any html that it does well, and it sometimes showed css changes, but I feel like I am doing something fundamentally wrong here. Thoughts?

+7
source share
1 answer

The problem is browser caching. You can: a) clear the browser cache or enable incognito browsing, or b) add some kind of cache interception to your css / js resources, i.e. foo.css?(timestamp) or foo.css?(version#) etc. For larger systems, the latter is better, t forces users to clear the browser cache after entering the production code.

+9
source

All Articles