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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s