Django — Automatically importing modules for python manage.py shell

Ever wonder how many hours of time you’ve wasted importing the same things over and over at the start of a python manage.py shell?

Imagine the number of times you forgot to import datetime or decimal, or your model even.

I’ve finally had enough and looked up ways around this problem.

Luckily, this iPython solution is amazingly easy. Cut and paste code into iPython’s config files (which are python as well) and you’re done!

http://djangosnippets.org/snippets/549/

It will take 2 minutes max.

Leave a Comment