views:

75

answers:

1

Ipython has a plugin called autoreload that will presumably reload all your modules after every command, so you can change the source and not have to quit the shell and reenter all your commands. See http://dsnra.jpl.nasa.gov/software/Python/tips-ipython.html for example.

However, this seems flaky at best when using it with Django, e.g. python manage.py shell gives me an IPython shell with Django context, but the autoreloading does NOT seem to work reliably at all.

Here's what I have added to my ipy_user_conf.py file:

def main():
    ... # rest of the fn here
    import ipy_autoreload
    ip.magic('%autoreload 2')

The autoreloading works in limited cases, maybe 10-20% of the time. Has anyone successfully configured this to work with Django?

A: 

This answer might also be applicable to your situation. Django keeps its own cache of all models, so if you want to reload everything, you have to clean this cache manually.

schot