About a year ago I’ve switched over to IntelliJ as my primary Java IDE. When I began to dabble a bit in Django a few days ago, I realized that IntelliJ had me spoiled when it comes to Editor Features – especially when working with Javascript and HTML files. Notepad++ – although a great text editor on its own right – simply didn’t cut it for me for web development.
When I tried opening my Django files in IntelliJ I had to realize that IntelliJ needs a project context for opening a file. Even for a simple html file. Fortunately the solution was pretty straight forward. Navigate to your Django project root directory and create a new file .project. Some of you have guessed it: we are pretending to be Eclipse. Open the file in a text editor and paste the following snipped into it:
<?xml version=”1.0″ encoding=”UTF-8″?>
<projectDescription>
<name>myproject</name>
<comment></comment>
<projects></projects>
</projectDescription>
Edit the <name> tag value and change it to your liking.
Now it’s time to launch IntelliJ. Select File -> New Project. Select Import project from external model and click Next. Select Eclipse (should be the default) and click Next. Now enter the path to your Django project root folder in the Select Eclipse projects directory field. Click Next. You should now see the name of your pseudo eclipse project in the list. Click Next. You may now change the project name or just click Finish. Open the project view and change to Project mode. Congratulations, you have imported your Django project into IntelliJ.
I’d suggest that you install the Pythonid plugin for IntelliJ in order to get a better Python code editing experience and that you add .pyc and .pyo to the Ignored files and folders in IntelliJ’s General Settings as final steps.
This is great! Thanks for your article. I am new at django and this will help a lot.