I have pydev/django installed in eclipse, and it runs fine. However, after adding a second django project to eclipse and running the server (‘http://127.0.0.1:8000’) the pythonpath seems to be stuck on project2 even when I run project1.
As a summary, I have two django projects: project1, project2. When I run the django server for project1 I get:
Validating models...
0 errors found
Django version 1.5, using settings 'project1.settings'
Development server is running at 'http://127.0.0.1:8000/'
Quit the server with CTRL-BREAK.
The above seems to suggest that django is using the correct settings file; however, when I go to ‘http://127.0.0.1:8000/’ it displays the urls from project2. Also, if I go to ‘http://127.0.0.1:8000/admin’ the models are getting pulled from the sqlite.db file in project2 as well. I’ve even tried removing project2 from eclipse entirely and now at ‘http://127.0.0.1:8000/admin’ I get this error:
Python Path:
[‘C:\Users\Brad\workspaces\In Progress\project2’,
‘C:\Users\Brad\workspaces\In Progress\project2’,
‘C:\Python27\DLLs’,
‘C:\Python27\lib’,
‘C:\Python27\lib\plat-win’,
‘C:\Python27\lib\lib-tk’,
‘C:\Python27’,
‘C:\Python27\lib\site-packages’,
‘C:\Windows\system32\python27.zip’]
If I run the server on a different port with project1 the path seems to be fine:
runserver 7000 –noreload
Then ‘http://127.0.0.1:7000/’ uses project1’s paths, but it doesn’t seem like I should have to do this.
Note: I have setup the run configurations as correctly as I know how. In the main tab, the project and main module both point to the correct project (project1), and the “PYTHONPATH that will be used in the run:” includes project1. Also, I have cleared my browser history, cookies, and everything that chrome would let me delete.
The problems seems to be that you’re using the autoreload feature (in which case, you’re terminating the process on eclipse but the spawned process is still alive in that port). So, you have to manually go to the task manager (if on windows) and kill the child process.
You should either use it with no autoreload or follow the steps at: http://pydev.org/manual_adv_django.html (in the end of the page) to have autoreload spawn a terminal for the child so that you know it’s alive.
I opened a bug regarding that in Django previously: https://code.djangoproject.com/ticket/16982 and someone seems to have provided a patch to fix that at https://code.djangoproject.com/ticket/19137