[Answer]-Django web application and ways to flush cached media

1👍

Flushing can by done with:

python3 manage.py clear_cache

You may also need to collect and compress the static files, as well as clear Django’s cache of static files:

python3 manage.py collectstatic --noinput --clear
python3 manage.py compress --force

That will have to be done as a user with permission to the deployment directory, and so that the web service serving Django will have permission to read those.

The Django cache files can usually be seen in a directory like:

.../static/CACHE/css/
.../static/CACHE/js/

Side note:

It may better, if the system has netcat, to flush memcached without restarting it, since you said you are making changes to a production environment. Obviously, your situation is not ideal, but besides that. Django may throw internal server error (500) if it cannot use the cache when someone goes to the page.

echo 'flush_all' | netcat localhost 11211

Or whatever the memcached instance’s port is.

👤Kevin

Leave a comment