-
Notifications
You must be signed in to change notification settings - Fork 2
Installing and Configuring Eclipse
Eclipse is an integrated development environment that can be useful for editing and debugging the OPS Django application. This page is intended to be a guide for setting up Eclipse in the OPS development VMs. For information on how to use eclipse, see Using Eclipse.
Downloading and installing Eclipse
Configuring OPS as a Django Project
-
From the VM, download the latest version of eclipse with firefox here.
-
Enter the following lines of code in a terminal:
sudo -i # switch to root
tar -zxf /home/ops/Downloads/eclipse*.tar.gz -C /opt # unzip, untar and send outputs to /opt/ directory
chmod -R +r /opt/eclipse # allow any user to use eclipse
# Create a new run script in /usr/bin/ for eclipse:
touch /usr/bin/eclipse
chmod 755 /usr/bin/eclipse
-
Open the new /usr/bin/eclipse file with gedit:
gedit /usr/bin/eclipse
-
Paste the following into the file:
#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*
-
Save the file and exit gedit
-
start eclipse from the terminal:
eclipse&
-
If everything worked propertly, a 'Workspace Launcher' will open. Accepting the default is fine.
-
Remove eclipse*.tar.gz from /home/ops/Downloads:
rm -f /home/ops/Downloads/eclipse*.tar.gz
Pydev is a plugin for Eclipse that enables Python and Django projects.
-
From the toolbar, navigate to Help->Install New Software...
-
Click 'Add' next to the 'Work with' and enter
PyDev
for name andhttp://pydev.org/updates
for location. -
Check the 'PyDev' selection box after it appears and click Next.
-
Select PyDev for Eclipse and click Next.
-
Accept the terms of the license agreement and click Finish. When a 'Selection Needed' box appears, check the box next to 'Brainwy Softward; PyDev; Brainwy' and press OK.
-
Restart eclipse when prompted.
-
Select File -> New -> Project
-
Select PyDev -> PyDev Project. DO NOT SELECT PyDev Django Project YET. Click Next.
-
Name the project 'OPS'.
-
Un-check 'Use default' under project contents. Enter
/var/django/ops/
for the Directory. -
Click the 'Please configure an interpreter before proceeding' and select 'Manual Config'.
-
A Preferences window will open. Click 'New...'. Put
Python2.7
as the Interpreter Name and/usr/bin/venv/bin/python2.7
as the Interpreter Executable. Press OK. Click OK again when the 'Selection Needed' window appears. -
In the Preferences window, click 'Apply' and then 'OK'.
-
Select Python2.7 under Interpreter.
-
Click 'Finish' and select 'Yes' when prompted to open the PyDev perspective.
-
Minimize the main Eclipse page by pressing the minus button near the upper right of the eclipse window.
-
Press the Python icon on the upper left side of the eclipse window. Expand the selection so you can see the OPS project directory tree.
-
Open one of the OPS files (ops->views.py, for example). Click 'OK' when prompted to set Default Eclipse Preferences for PyDev.
-
Click 'Read it' when prompted to help keep PyDev alive.
-
Expand the file opened in step 12 so it takes up most of the eclipse window. Leave the directory tree docked to the left side of the window (these can be changed later, but this is a standard view).
-
Right-Click the OPS project at the top of the directory tree. Go to PyDev -> Set as Django Project.
-
Right-Click the OPS project again and go to Properties. Select the PyDev-Django properties and put
manage.py
for Django manage.py andops.settings
for Django settings module. Press 'Apply' and then 'OK.' -
Eclipse and PyDev are now configured to recognize the OPS project as a Django application. See the Using Eclipse page for more information on how to effectively use Eclipse with OPS (Not available yet).