开发者

Django-Pydev-Eclipse and multiple projects problem

I have set up Eclipse (Windows XP) with pydev in order to run and debug a django web app project I ha开发者_如何转开发ve. I also have this projcet under subversion control. At the moment I have a working copy of the trunk operating within Eclipse (with full debugging capability). I always run into problems when I check out a branch of this code and run it in a sperate eclipse pydev project. I have the PYTHON interpreter set to the right manage.py and work locations, but when I run/debug this branch code it always appears to be running the code that is resident in the truck project. I've tried restarting Eclipse/My computer but to no avail. This should work as I have had both working separately in the past, but can't figure out what I have forgotten to do. Any ideas?

Thanks, G


I'm using Python 2.7 + PyDev + Aptana on Windows 7 64-bit.

I created a separate branch for my project in svn, and imported that branch as a new project. From there, I created a debug configuration (Run > Debug Configurations).

Under the Python Run section I created a "My Test Branch" debug configuration setting manage.py as the main module and passing in: runserver 8000 --noreload as the program arguments.

When I imported the project, I purposefully named the project folder differently so any module imports referencing the folder in my Django app would fail. This is a bullet-proof way to make sure the debug is using the right settings and reading from the correct files. Example:

My trunk project folder name is: "my_website" My branch project folder name is: "my_branch_website"

So, an import like:

from my_website.models import MyModel

would fail when debugging the branch.

When I run the debug configuration, and load: http://localhost:8000/ I got the expected result - the imports fail and the project won't run.

So, I checked out that branch into a separate folder from where the trunk is checked out so I can name the checkout folder the same as trunk, ran the debug configuration, and it loads the correct settings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜