ruddra ruddra - 1 year ago 126
Python Question

Using IntellijIdea within an existing virtualenv

I want to use Intellij Idea within my existing python django project which was built within a virtual environment in ubuntu. How do I configure Intellij Idea to use the libraries of the virtual environment?

Answer Source

Well I solved the above problem. I have added virtualenv folder's python to project sdk. The virtualenv directory's python( for example venv/bin/python2.7) needs to be added to Intellij Idea project path. Example: need to go to file>project structure (intellij Idea) enter image description here

press new in Project SDK, and add new path to virtualenv's python directory like this:enter image description here

Go to Modules>Dependencies and set your module sdk to Python SDK which is marked on this picture: enter image description here

Click on Django (option marked in next the image) and set Django project root, Settings,Manage Script like this:enter image description here

Now press ok and final look of the Project settings: enter image description here

Now need to run the project.