Issue
I'm not sure whether including python3.6/site-packages
to the system pythonpath when setting up a PyDev workspace is correct.
I'm using Eclipse IDE for JavaScript and Web Developers (version 2018-12 4.10.0) with PyDev to use Django 2.1.5 from a virtual environment, on Ubuntu 18.04.
Main steps leading to the issue
Set up the virtual env with:
python3 -m venv djvenv
Activate the venv in shell:
source djvenv/bin/activate
Install and test
Django~=2.1.5
fromrequirements.txt
using commandspip install -r requirements.txt
anddjango-admin --version
(returns2.1.5
)In Eclipse, create a new workspace in directory
workspace
.Set the Python interpreter to match the one from the virtual environment in directory
djvenv
viaWindow > Preferences > PyDev > Interpreters > Python Interpreter>
(set interpreter name to e.g.python3-djenv
and interpreter path to:/home/<username>/dj-workspace/djvenv/bin/python3
), and accept.In the next prompt, tick the box to include the
python3.6/site-packages
directory to SYSTEM pythonpath. Click OK, then Apply and close
Omitting to include the site-packages directory will result in a "Django not found."
message when creating a Django project with File>New>Project>PyDev>PyDev Django Project
.
Is it correct to include python3.6/site-packages
here?
What bothers me is that it is specific to my project, while PyDev warns, in all caps:
“IMPORTANT: The folders for your PROJECTS should not be added here, but in your project configuration.”?
Solution
That's correct and that folder should be added...
-- what it means when it says that some file/folder is specific to your project is that files you're going to edit yourself should not be added under that configuration, and should be only added as a source folder in your own project.
Answered By - Fabio Zadrozny
Answer Checked By - Gilberto Lyons (JavaFixing Admin)