Python + Django + Eclipse + Pydev != C# + VS.Net

I use to think that once you're use to 2 or 3 programming languages, you can learn another one easily but my thought now is that specialization is important. If you are a Python developer learning C# you not only need to know the syntax but the best practices, the know-how, and you won't get that in two weeks (as the common wisdmon says). So Python is not Java nor C# and the know-how is hard to get. The past month I've been researching and thinking of things like... "How do I write a static method in Python?" and then realizing that the philosophy is different so you just need to write the function in a module and call the function as ModuleName.Function which in terms of API looks like a static method. Actually if you follow the name conventions it should be moduleName.function (mind the case).
If you're learning Python and you come from a strongly typed language, just keep this in mind: implementation in Python should be written fast and easy, otherwise, you're probably thinking wrong.

This does not mean Python is better than Java or C#, I see it as another option for some kind of problems. It is my favorite choice when it comes to scripting, system administration or code generation.

In my current environment people uses Vim or Emacs to write source code which is a common trend within the Open Source world. However I do believe that IDE's improve productivity and I just can't write code without Intellisense (Autocompletion). I am using Eclipse as my IDE along with the Pydev plugin that enables Autocompletion, syntax highliting, indentation and so for Python. Some fine tuning for the development platform:

Define JAVA_HOME in ~/.eclipse/eclipserc: JAVA_HOME=/usr/lib/jvm/java-6-sun

Make sure you install the latest Pydev. I installed it from the .zip rather than the Eclipse updater. Once it is installed, go to the Windows Menu, Preferences, Pydev, and "Interpreter - Python". Add python 2.5 there.
If you install Django after all of this, you have to go to Pydev configuration again, remove the python interpreter and add it again in order for Pydev to recover all the information about Django objects. See this post. If you want to use Django in a console application, i.e, you just want the ORM to work with models, then you need to define two environment variables and make sure Eclipse knows them:

export PYTHONPATH=$PYTHONPATH:/home/carlosble/workspace/yourproject
export DJANGO_SETTINGS_MODULE=settings
eclipse &

That assumes the settings file is inside yourproject folder.

Cheers

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
  • http://jadarios.wordpress.com esauro

    I have found a video at youtube showing someone debuggin using Eclipse + PyDev + Django.

    It’s a pity the low quality youtube have for certain things like copy the environment values the programmer has but it can’t show how far can get.

  • http://jadarios.wordpress.com esauro
  • http://carlosble.com Carlos

    Hi Esau!!!!
    Thanks a lot for the video mate!.
    Esau is one of my Django teachers 🙂

  • DT

    Python *is* strongly typed.

  • http://Iloveyoursite nod32

    I love you site

  • http://www.tires-wholesale.com/BF_Goodrich_Radial_TA_Tires.html BF Goodrich Radial TA Tires

    Absolutely indited content material, Really enjoyed looking at.

  • http://www.bagfavorite.com/index.php/Louis-Vuitton-Wallets-cid-1413.html louis vuitton wallets for men

    magnificent points altogether, you simply gained a new reader. What would you recommend about your post that you made a few days ago? Any positive?

  • http://mynameisjason.com/member/41076 Website

    I have been surfing on-line more than 3 hours nowadays, yet I never found any attention-grabbing article like yours. It’s lovely worth sufficient for me. In my view, if all webmasters and bloggers made good content material as you did, the web can be a lot more useful than ever before.