Why I prefer PyCharm:
- Template Debugging. (you can set a normal breakpoints in templates)
- Easy Virtualenv connection. (Set an interpreter from your virtualenv and you're ready to roll)
- Has excellent set of most common CVS integrations (Git, SVN, Redmine, etc...)
- Has looots of tiny tasty things for coding and proper code highlighting over JS and HTML out of the box)
- Has proper and shiny themes out of the box.
So I'm a blind minded blond, it seems now. But design of this IDE is really attractive IMHO :)
- OH and it's quite quick and has ALL the functions I need.
Here is a brief instruction to setup PyCharm IDE to work with my typical Django project.
1. First thing you need is a PyCharm installation. You can get it here (official website) for a 30 day trial for free. And this project has way of free licensing for Open Source projects. For everyone else it's 100$. Guess what? I'm open-source developer :).
2. I guess you'll be ok to install it by yourself. Nothing too special here. Just a normal setup depending on your platform. (I use Mac OS X Lion. And for me it's just a "drag to ~/Applications folder").
3. Now that you have it installed you can dive into it's magic. lets setup a new project like you do most of the times from console first.
$ cd developer $ mkdir testproject $ cd testproject $ virtualenv testvenv --no-site-packages New python executable in testvenv/bin/python Installing setuptools............done. Installing pip...............done. $ source testvenv/bin/activate (testvenv)username:testproject leopard$ $ pip install django Downloading/unpacking django Downloading Django-1.3.1.tar.gz (6.5Mb): 53% 3.5Mb ... $ django-admin.py startproject mysite $ cd mysite $ ls -l total 32 -rw-r--r-- 1 leopard staff 0 Jan 10 11:13 __init__.py -rw-r--r-- 1 leopard staff 503 Jan 10 11:13 manage.py -rw-r--r-- 1 leopard staff 5031 Jan 10 11:13 settings.py -rw-r--r-- 1 leopard staff 565 Jan 10 11:13 urls.py $
Now that we have created typical project with virtual environment and a project dir inside it.
4. Let's connect it to PyCharm. Press "Open Directory" in either ("File > Open Directory") main menu or on this fancy welcome screen.
After those actions you must get something like this:
5. Now that we have connected PyCharm to our Django Project... We need to setup interpreter. For PyCharm to work correctly with virtualenv and rund project in the specific environment... We simply need to specify Python executable (from our virtualenv) for this project and enable Django support.
It is all done in main menu ("PyCharm > Preferences"). We now need to select "Django support" and add make sure it's checked "enabled". Nw we need to specify manage.py and settings.py scripts. They will bee needed later for setting up run configurations.
6. After this we need to setup our virtual environment to be used with this IDE. PyCharm is quite sophisticated and does almost everything by himself. You basically need to add a new Python interpreter. PyCharm detects that it's a virtual environment and links and indexex all by himself. You need to select "Python Interpreter" in those preferences panel and press "Add New" > "Select other" in the top right corner. After that you need to point out to your "virtual-environment directory > bin > Python executable". PyCharm will scan for environment and connect it to where needed.
Select newly added interpreter and press "OK". TADAAA!!!!
AND we're almost ready to roll...
7. Creating Run configuration.
Now we have our project all set up and connected. We need to setup a proper run for our environment. Notice button "testproject" with Django logo appeared in the main buttons tab at the top. Pres a drop down menu and select "Edit configurations". Imho this part is a masterpiece here. It has nothing more than I usually need to run even sophisticated projects.
I'm specifying the "Host" to be run on local IP: 127.0.0.1 or "localhost" if you prefer so :). And i'm checking "No reload" option to manually reload server after some code changed. I prefer it like so to avoid various server hangouts and need to reboot entire Mac if something goes wrong. And now we're ready toclick "OK". And that's basically It.
You can now press "Run" button and check your browser showing 127.0.0.1:8000 shows Django test page. Or go directly to testing delicious debugger by running "Debug" button.
Comments are welcome!