I recently added two new commands to the django-extensions project.
- clean_pyc, removes all compiled python bytecode files from your project directory
- compile_pyc, compiles all python files to bytecode files in your project directory
These are handy shortcuts to what you would normally do with something like "$ find -name "*.py[co]" -delete" or python's compileall import. The main added advantage is a little piece of code that checks the correct working directory. So it will only compile or delete files in your project root, even if you call manage.py from somewhere else.
One other thing to note is that you will always see files being deleted when you call "$ ./manage.py clean_pyc -v" this is because when manage.py gets loaded python will compile files in your project root which are then in turn deleted by the command ;-)
Check it out at: http://code.google.com/p/django-command-extensions/
Posted on September 8, 2008