I'm fairly new to Eclipse and I have been trying to import a Django project I had made separate from Eclipse. It would be most helpful if someone could give me a step-by-step guide on how to import my Django project.
All I was able to find was to import the file hierarchy but that led to either incomplete imports or importing folders I didn't want. Any help would be appreciated.
If you created the project inside Eclipse, you just have to import the project again (in files > import > general > existing projects into workspace) – it'll look for the existing . project file and will configure it automatically from the existing configuration.
Copy & Paste Select the files I want to add in the Explorer/File manager, and copy them (CTRL-C on Windows) Paste them in the project/folder in Eclipse (CTRL-V on Windows)
Go to the menu: Alt + R + S + The number of the Run you wish (It can be Python, Jython, unit-test, etc). Note: if you were using unit-tests, you could use: Ctrl+F9 to run the unit-tests from the module (and even selecting which tests should be run -- and if Shift is pressed it's launched in debug mode).
If it is not an Eclipse project, then you have to create a new Eclipse project in the root of the Django project.
Go to File menu, click New > Project.
Select Pydev Django Project, assuming you have added the PyDev and PyDev Django plugins to Eclipse. Click Next.
Give your project a name, then browse to the location where your Django project exists (where your manage.py, settings.py, and url.py is).
Select a Python Grammar to use (anything prior to 3 - there are some issues with 3 and Django).
Click Next, and Next again (don't need to reference other projects).
Enter database details and click Finish.
Your Eclipse/Django project is ready to go.
This is a moderately painful process, but I have gone through it in Kepler (Eclipse 4.3), with the recent Pydev version.
Assuming you have the sources somewhere on your system, not in the workspace folder.
Now you'll see the files in the tree ("Pydev Package Explorer"), will be able to edit etc, but you can't run this (manage.py runserver) or run unit tests (manage.py test).
To do this, right click the project and choose Pydev > Set as Django project (see here: http://pydev.org/manual_adv_django.html)
Now go to properties and configure the settings module, and path to your manage.py
.
Caution: this is relative to your project directory in the workspace. Even if you type /path/to/my_django_project/manage.py
.
So, I ended up doing this (bash):
$ cd $HOME/workspace/my_django_project
$ ln -s /path/to/my_django_project
and left the configuration as "my_django_project/manage.py" and "settings".
(in Windows you could do the same within 1 Volume - using mklink /J
)
Now, it all works like a dream - there is a "Django run configuration" for my project, the files get modified in the working copy checked out outside of workspace, unit test run nicely and all is fine. If I just were able to make Subclipse see my sources as a working copy, I'd be almost like on PyCharm (except for a Django Template syntax-highlighted autocompleting editor, richer code inspections, and the automatic recognition of such sources as a django project).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With