Close TCP port 80 and 443 after forking in Django

Posted by audiodev on Stack Overflow See other posts from Stack Overflow or by audiodev
Published on 2012-10-18T03:38:53Z Indexed on 2012/10/18 5:03 UTC
Read the original article Hit count: 109

Filed under:
|
|
|

I am trying to fork() and exec() a new python script process from within a Django app that is running in apache2/WSGI Python. The new python process is daemonized so that it doesn't hold any association to apache2, but I know the HTTP ports are still open. The new process kills apache2, but as a result the new python process now holds port 80 and 443 open, and I don't want this.

How do I close port 80 and 443 from within the new python process? Is there a way to gain access to the socket handle descriptors so they can be closed?

© Stack Overflow or respective owner

Related posts about python

Related posts about django