Multiple Django projects using one virtualenv environment

It seems that PyCharm does not allow associating a Django project with a virtual environment if that environment was previously associated with some other Django project. Is it by design or a bug?

If a new project is being created, there is a way to associate it with any virtual environment. But then, in the PyCharm settings, the "Project Interpreter" shows <None>. And the list of available environments does not include the target environment. If button "Show virtual environments associated with other environments" is clicked, the target environment shows, but there is still no way to associate it with the current project.

If you try to change the environment associated with a project, PyCharm does not show environments that were previously associated with some other project.

If this is by design, i believe it should be changed. It seems to be absolutely normal to have multiple Django projects using one virtual environment. If you see a problem in this logic, could you please let me know?

There is a big chance that i just missed something. If this is the case, could you please point me at the right direction and show how to associate multiple Django projects with one virualenv environment?

Thank you,

-igor



Attachment(s):
pic3.png
pic2.png
pic1.png
5 comments
Comment actions Permalink

"Associating" a project with a virtual environment means that this virtual environment is only shown when this project is active. A virtual environment which is not associated with any project can be selected as the project interpreter for any number of projects; the selection is done under Settings | Project Interpreter.

0
Comment actions Permalink

I have multiple virtualenv environments. One of them is named "clean."

As picture pic21.png shows, environment "clean" cannot be selected as the project interpreter. But as pic22.png shows, this environment does exist. Why cannot it be assigned as the project interpreter then?

Thank you,

-igor



Attachment(s):
pic22.png
pic21.png
0
Comment actions Permalink

It's not shown in the combobox because it's associated with another project. If you remove the association, it will be shown in the combobox regardless of what project you have opened.

0
Comment actions Permalink

Hi Dmitry,

Thank you for taking care of this issue. You are absolutely correct in your explanations; I just believe the association should not prevent from using this environment with other projects :-)

I found the settings in C:\Users\<my_login>\.PyCharm20\config\options\jdk.table.xml. There the “clean” environment was associated with some project (testproj) that I deleted some time ago. I removed the ASSOCIATED_PROJECT_PATH attribute from the “additional” element, and that fixed the problem… But was that association really needed? Maybe… But why would it hide this nice environment (building which took some amount of time) from other projects?

BTW, this new feature (managing virtualenv environments from inside PyCharm) is totally awesome! And I love PyCharm. Thank you for doing great job with PyCharm project :-)

Best wishes,

-igor

0
Comment actions Permalink

The whole point of the "associate" feature is to reduce clutter when selecting an interpreter for a project by removing the virtualenvs which you have created specifically to be used in other projects.

0

Please sign in to leave a comment.