0

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.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
bcorso
  • 45,608
  • 10
  • 63
  • 75
  • you run it using eclipse or terminal? maybe try using terminal? – Otskimanot Sqilal Dec 15 '12 at 23:15
  • I just tried from the terminal and have the same effect. It could be a browser issue, but I've already tried clearing all of the data in chrome (history>>clear all browsing data, and deleted everything with the beginning of time option). – bcorso Dec 15 '12 at 23:42

1 Answers1

0

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

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
  • Yes, I am on Windows. I'm using eclipse and it uses the --noreload option. Is there a way to identify the child process in the task manager? – bcorso Dec 17 '12 at 05:38
  • You can probably just kill all python occurrences (i.e.: from a cmd shell: taskkill /F /IM python.exe) – Fabio Zadrozny Dec 17 '12 at 16:27
  • At this point I can't confirm for sure if this was the actual problem because the problem seems to have resolved itself without me seeing any anomalous processes in task manager or manually killing any process. However, my computer has rebooted since I posted this, and I suspect that you were right about my problem and rebooting has killed all of those processes for me. I'll update if it happens again and I can pin it down for sure. – bcorso Dec 20 '12 at 03:38