hello,
i do not know what causes this.
i am curious what happens if you replace
return HttpResponse(stdout or stderr)
with
return HttpResponse('hello world')
this is how i would debug
konstantin
On Mar 12, 10:03 pm, "Ino Pua" <[EMAIL PROTECTED]> wrote:
> Quick way of reproducing:
>
> 1. Start a new project
> 2. Replace urls.py with:
>
> from django.conf.urls.defaults import *
> from django.http import HttpResponse
> import subprocess
>
> def start(request):
> cmdname = request['cmd']
> p = subprocess.Popen([cmdname, 'start'], stdout=subprocess.PIPE)
> stdout, stderr = p.communicate()
> return HttpResponse(stdout or stderr)
>
> def stop(request):
> cmdname = request['cmd']
> p = subprocess.Popen([cmdname, 'stop'], stdout=subprocess.PIPE)
> stdout, stderr = p.communicate()
> return HttpResponse(stdout or stderr)
>
> urlpatterns = patterns('',
> (r'start/$', start),
> (r'stop/$', stop),
> )
>
> 3. Start the django server (python manage.py runserver 8080)
> 4. Access an url like:http://localhost:8080/start/?cmd=/etc/init.d/exim4,
> or any cmd= that starts a service (anything that daemonizes). You'll
> notice that the loading bar (in my firefox at least) never stops
> loading, even though the django web server is done with the request,
> and the page has been rendered.
> 5. If you now stop the server and try to start it again, it wont be
> able to bind to its port:
>
> Validating models...
> 0 errors found.
>
> Django version 0.96-pre, using settings 'starter.settings'
> Development server is running athttp://127.0.0.1:8080/
> Quit the server with CONTROL-C.
> Error: (48, 'Address already in use')
>
> However, at this time, Im not sure whats causing this to happen. Any
> ideas would be appreciated.
>
> Shutting the started service down manually, or accessing the /stop/?
> cmd= url before stopping the django server fixes the problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---