We all know that Django is great Python web framework, however one thing that bothers me is the lack of good development tool (Yes, I know there is VIM, and there is Emacs but guys it is 2008.) In my humble opinion best development tool for python is PyDev, Eclipse plugin for Python. The irony is that the best Python IDE is written in Java :).
With PyDev and Aptana, another irreplaceable plugin(but that is another story), you can do great Django development.
There are lot’s of tutorial how to use Django and PyDev (Configuring PyDev to work with Django : configuring pydev to work with django is a good place to start).
One thing that is very nice in Django is interactive shell, but this feature must be integrated with IDE, I missed this feature for long time, but in version 1.3.15 PyDev released new interactive console, great feature. First you need PyDev version 1.3.15 or higher (try to use latest one).
You can start interactive console from Console View by clicking on the button Open Console(look picture below).
You will get a dialog asking for a type of console you want to open, select Python console and press OK.
That is it, you have now working python interactive console. Out of the box you get some nice features like autocompletition and syntax coloring. What we want do next is to have interactive console for Django.
Here is a little tutorial how take advantage of PyDev interactive console for Djagno shell.
- Open Window–>Preferences…
- In Preferences Window go to PyDev-> Interactive console
3.In initial interpreter command put following code:
1 2 3 4 5 6 7 8 9 10 |
|
Where YOUR_OWN_PROJECT is the name of yours top level Django project. It is important to mention that if you have multiple Python/PyDev projects in your workspace you have to change your preferences configuration every time you want start interactive console for anathor project. After starting the shell, you will get output something like this:
1 2 3 4 5 6 7 8 9 10 11 |
|
That is it, you have working Django interactive console. Now you can do things like this:
1 2 3 |
|
But there is also autocompletition:
Enjoy!