0

I'm using an app called django-chronograph. It has a code of line which works in my dev environment and does not work in production:

p = subprocess.Popen(['python', get_manage_py(), 'run_job', str(self.pk)])

This line crashes in production with: unknown command run_job Whereas when I run directly from command line: manage.py run_job It works fine.

Interestingly it worked once when we exchanged 'python' with 'usr/bin/python'. then we restarted the server once more and it was back to old behaviour.

Thus it seems as we have a python path issue. I'm not the guy who is running the server, its my app that should run and it would be great to get some help here. Attention: I'm a total noob regarding server-administration..

server environment: NGINX with FCGI-Daemon FCGI in prefork-mode

Tom
  • 113
  • 1
  • 7

1 Answers1

1

Yeah, uh... don't do that.

django.core.management.call_command('run_job', str(self.pk))
kasperd
  • 29,894
  • 16
  • 72
  • 122
Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
  • Ok that s a good hint. I will replace it and I guess this will overcome my problem. Just for curiousity, why do you think subprocess.Popen should be absolutely not used ? Maybe then I should tell the author of django-chronograph.. – Tom Apr 30 '10 at 07:18
  • Because there's already a perfectly good mechanism for invoking commands from within the app itself. – Ignacio Vazquez-Abrams Apr 30 '10 at 09:17
  • -1 call_command is blocking; Popen is not – Greg Schmit Oct 09 '18 at 18:58