82👍
For PyCharm 2018
As per documentation from Pycharm:
- In the Project Interpreter page, click and select Add.
-
In the left-hand pane of the Add Python Interpreter dialog box, select Virtualenv Environment. The following actions depend on whether
the virtual environment existed before. -
If Existing environment is selected:
- Specify the required interpreter: use the drop-down list, or click Select an interpreter and find one in your file system.
- Select the check-box Make available to all projects, if needed.
-
Click OK to complete the task.
For Pycharm 2016 and later
To add an existing virtual environment to the list of available interpreters
- In the Select Python Interpreter dialog box that opens, choose the desired Python executable, located inside the virtual environment folder, and click OK.
Go to this link for more information.
For Older versions:
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)
press new in Project SDK, and add new path to virtualenv’s python directory like this:
Go to Modules>Dependencies and set your module sdk to Python SDK which is marked on this picture:
Click on Django (option marked in next the image) and set Django project root
, Settings
,Manage Script
like this:
Now press ok and final look of the Project settings:
Now need to run the project.
2👍
The above answer is based on older version of IntelliJ. For new, look here: https://www.jetbrains.com/help/pycharm/2016.1/adding-existing-virtual-environment.html
- [Django]-How to filter objects for count annotation in Django?
- [Django]-How can I tell whether my Django application is running on development server or not?
- [Django]-How to query as GROUP BY in Django?