[Django]-How to clear code cache in python/django?

2👍

Older versions of django

find . -name "*.pyc" -exec rm -rf {} \;

New version of django has this:

python manage.py clean_pyc

If you simply want to restart the webserver it depends on the configuration you are using:

  1. via gunicorn:
    use --reload option

  2. via django inbuilt runserver:
    since version 1.7 it automatically does that.

👤anand

1👍

Just touch the WSGI file: touch wsgi.py and your project should refresh.

Please have a look at this similar request: How to reload new update in Django project with Apache, mod_wsgi?

Leave a comment