Does IntelliJ fully support Python/Django just as well as Pycharm?

Hello,

I'm still very new to IntelliJ (trial version for now) but I was wondering if IntelliJ offers exactly as much as Pycharm does for Python and Django. I would just get Pycharm but sadly I need support for PHP too and I don't want to mess around with needing 2 IDEs. I ask because I can't even find a single Django plugin in the repository. What am I missing to get full Django support for IntelliJ? Google is coming up empty.

15 comments

Hello,

The Python plugin for IntelliJ IDEA includes the Django support; there is
no separate plugin for Django. The latest PyCharm features are only available
in the version 2.6.x of the plugin, which requires IntelliJ IDEA X EAP. Plugin
version 2.5 is compatible with IntelliJ IDEA 9 but doesn't include all of
the latest features.

I'm still very new to IntelliJ (trial version for now) but I was
wondering if IntelliJ offers exactly as much as Pycharm does for
Python and Django. I would just get Pycharm but sadly I need support
for PHP too and I don't want to mess around with needing 2 IDEs. I ask
because I can't even find a single Django plugin in the repository.
What am I missing to get full Django support for IntelliJ? Google is
coming up empty.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

I have to wonder if I have something installed improperly, or are you saying Django support is only in 2.6+?

Right now it won't pickup the imports from Django nor does it understand Django methods with the Python plugin installed. It keeps saying it lacks a reference. There is also no code complete and syntax highlights for the template code too.

0

Hello,

You need to create a Django facet for your Python module in order to enable
Django support in the Python plugin.

I have to wonder if I have something installed improperly, or are you
saying Django support is only in 2.6+?

Right now it won't pickup the imports from Django nor does it
understand Django methods with the Python plugin installed. It keeps
saying it lacks a reference. There is also no code complete and syntax
highlights for the template code too.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

When I goto the project structure -> Facets section the Django facet is empty. I added the Django source/class to the Python SDK/global paths too but I have Django installed under /python2.6/site-packages/django which makes me think it's picking it up already without this since the site-packages directory was already there.

Can you write an idiot's guide to getting Python/Django working flawlessly after installing the Python plugin?

0

Ok, the problem I was having was that I was trying to import an existing code base into a project. Haven't quite figured this out to work exactly how I want it but after making a new project and fooling around a bit with the IDE I got it to work quite well as long as I make a new project. All of the code complete/syntax highlighting seems to work.

Running a local server using sqlite also worked right off the bat.

Btw you guys really nailed it. If you continue to develop IntelliJ to support Django just as well PyCharm there's a good chance I'm going to buy this. Nothing (and I mean nothing) comes close to how awesome this product is for an overall web development IDE.

0

I also have another question which ties into getting Python/Django working properly. One of the biggest points that Django tries to make is that you should be creating applications separately and then use a project to tie together your applications.

I'm currently working through the 'Apress - Practical Django Projects 2nd Edition' Book and I've reached the point where the author is asking you to make an application rather than a project. The problem I'm having is how do I get IntelliJ to work with this mindset? Let's say I want to develop an application and I want to test the application as I'm developing it, so far the only way I've figured out how to do this is to create a skeleton project which runs the application(s) but this requires me to do naughty things like hard code the project name in the models for my applications and also have the application reside within the project path.

I'm also stumped now on how to get the tagging application (part of the book's lesson) working together inside of my project without copying the source to my project folder.

Ideally I want a local setup like:

/dev/web/python/django/tagging
/dev/web/python/django/weblog

And then be able to develop/use these applications by including them into an IntelliJ project that might be in a different location. I tried adding the paths as libraries (both class and source) but it still doesn't pickup the import statements correctly.

What do I need to do to get this setup properly?

Thanks.

0

Ideally I want a local setup like:

/dev/web/python/django/tagging
/dev/web/python/django/weblog
And then be able to develop/use these applications by including them
into an IntelliJ project that might be in a different location. I
tried adding the paths as libraries (both class and source) but it
still doesn't pickup the import statements correctly.

What do I need to do to get this setup properly?


I know nothing about Django however it sounds like you should be putting
each application in its own IDEA module. In your example above, try creating
two modules in your project, once for the 'tagging' application and one for
'weblog'. Modules can live anywhere, they don't have to be under the project
root.


0

Unfortunately this doesn't want to work either. I can point it to the /tagging/ application but the code complete won't pick it up.

Just to be fully clear I'm trying to use applications from a different directory of where my intellij project lives.

Example:

/dev/web/python/django/apps/tagging/
A django application that's re-usable.

/dev/web/python/django/projects/somewebsite.com/
A django project for some website. This is the real django project. This project will use /tagging/ or any other application in the /apps/ folder. I'm ok with the /.idea/ folder living here since that's easy enough to exclude when I move off my local server and put it onto a real web server. I would like to be able to debug or edit /tagging/ from within any project that uses it.

Edit:
I think I got it, maybe someone can chime in to make sure this is the right way to do it.

Under Project Structure -> Platform Settings -> SDKs

Add the path to /dev/web/python/django/apps/ (or whatever path you want). This appears to work. I can import them correctly and all code complete works + the local server is running fine. Then to access the code you can find it under external libraries.

I guess the only issue now is it's kind of clunky to create an application that's decoupled from your project. Right now you can open the manage.py command window and do a 'startapp' command but it makes the application in the project folder with no way of specifying a different path. That means you would have to start the app up, then manually move the folder into your /apps/ folder.

0

Actually it's still not working. Adding the apps folder to the SDK path only allows IntelliJ to figure out the code complete. When it comes time to running the server it fails to detect the module (aka. application). However if I open the Python interpreter and manually do a sys.path.append('/full/path/to/folder') then I can import from it successfully but that doesn't help me get it running.

So I guess my question is where do I need to go in IntelliJ to tell it "hey, there's a full directory of applications at THIS path, add the path to the Python interpreter so it actually works when I run the dev server". I tried pretty much everything under the sun in the project structure settings and it always fails.

I also tried editing the environment variable in the "Django Test" configuration but the test thing doesn't run, only the "Django server" runs. The problem is there's no environment option for the server.

0

Hello,

Try marking "THIS path" as a source root in the module settings.

Actually it's still not working. Adding the apps folder to the SDK
path only allows IntelliJ to figure out the code complete. When it
comes time to running the server it fails to detect the module (aka.
application). However if I open the Python interpreter and manually do
a sys.path.append('/full/path/to/folder') then I can import from it
successfully but that doesn't help me get it running.

So I guess my question is where do I need to go in IntelliJ to tell it
"hey, there's a full directory of applications at THIS path, add the
path to the Python interpreter so it actually works when I run the dev
server".


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

I did try that before posting, it gives the same error. "ImportError: No module named tagging"

Where "tagging" is a Django application located in a different path off my Python path.

If it helps I am using Windows 7 and my SDK version of Python is 2.6 (I picked this because it happens to be what my web host uses when I decide to deploy my projects).

0

I went on a mission to figure this out and decided I'm not stopping until I figure it out. I found a solution that works but it's pretty messy.

After Googling for a while this is what I found:

To augment PYTHONPATH, run regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore and then select the folder for the python version you wish to use. Inside this is a folder labelled PythonPath, with one entry that specifies the paths where the default install stores modules. Right-click on PythonPath and choose to create a new key. You may want to name the key after the project whose module locations it will specify; this way, you can easily compartmentalize and track your path modifications.

Your new key will have one string value entry, named (Default). Right-click on it and modify its value data; this should be text in the same format as the Path environment variable discussed above--absolute directory paths, separated by semicolons. If one project will use modules from several directories, add them all to this list. (Don't bother attempting to add more string value entries to your new key, or to the original PythonPath key, since they will be ignored.) Once these new registry entries are in place, your scripts' import statements should work fine.


So I followed the instructions and now IntelliJ magically detects the path to my external code source and everything works. If I import sys.path and print it through the interpreter it also shows the directory being there.

I'm guessing IntelliJ can do this without writing to the registry through some sort of interpreter trickery. I can't imagine it's standard to do this every time you want to run a new project?

0

Is there a better solution to this problem? I work on multiple branches (checkouts) of my project at the same time (different working directory and intellij project files) and setting a Registry/Environ (mac) variable wont be easy.

My problem is much simpler - IntelliJ wouldn't recognize imports from within the project tree.  All I need is a way to specify PYTHONPATH per project file. I am on IntelliJ 10.5

Thanks
--
Harry

0

Hello Harry,

Most likely all that you need to do is to mark the directory which is the
root of the import hierarchy as a source root in the project structure dialog.
For example, if you have "from foo.bar import something", the parent directory
of the "foo" directory should be marked as a source root.

Is there a better solution to this problem? I work on multiple
branches (checkouts) of my project at the same time (different working
directory and intellij project files) and setting a Registry/Environ
(mac) variable wont be easy.

My problem is much simpler - IntelliJ wouldn't recognize imports from
within the project tree.  All I need is a way to specify PYTHONPATH
per project file. I am on IntelliJ 10.5


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

I can't find where to "Enable Django Support" in Intellij IDEA.  In PyCharm Django, Google App Engine, and more are in the "Languages & Frameworks" section of the settings. Is there something specific I need to do to enable Django in Intellij IDEA?

0

Please sign in to leave a comment.