Re: Managing a process from Django

2018-01-09 Thread Kasper Laudrup
Hi Antonis, On 2018-01-09 07:14, Antonis Christofides wrote: Ah, OK, sorry I didn't read all the discussion. So I guess that if you keep that in a global variable, it won't work if your Django app is running in many processes. (Besides, global variables are rarely a good idea.) I agree comple

Re: Managing a process from Django

2018-01-08 Thread Antonis Christofides
Ah, OK, sorry I didn't read all the discussion. So I guess that if you keep that in a global variable, it won't work if your Django app is running in many processes. (Besides, global variables are rarely a good idea.) If I understand the problem correctly, what I would do would probably be to touc

Re: Managing a process from Django

2018-01-08 Thread Kasper Laudrup
Hi Joakim, On 2018-01-08 22:50, Joakim Hove wrote: Sounds to me that what you want is a `singleton` implemented in Python . The fact that Django is involved does not seem to be very relevant? Indeed, that has crossed my mind and I'm sorry if this is in fact not very Django related. But I'm

Re: Managing a process from Django

2018-01-08 Thread Kasper Laudrup
Hi Antonis, On 2018-01-08 22:46, Antonis Christofides wrote: OK, but why do you need this? What functionality is this going to have? As I wrote in my original question, I'm attempting to write a Django application for managing DHCP leases and DNS entries. So, if a user changes an entry by

Re: Managing a process from Django

2018-01-08 Thread Joakim Hove
Sounds to me that what you want is a `singleton` implemented in Python . The fact that Django is involved does not seem to be very relevant? 8. jan. 2018 22:43 skrev "Kasper Laudrup" : > Hi Antonis, > > On 2018-01-08 22:10, Antonis Christofides wrote: > >> Hello, >> >> When you say "call [an ins

Re: Managing a process from Django

2018-01-08 Thread Antonis Christofides
OK, but why do you need this? What functionality is this going to have? Antonis Christofides http://djangodeployment.com On 2018-01-08 23:43, Kasper Laudrup wrote: > Hi Antonis, > > On 2018-01-08 22:10, Antonis Christofides wrote: >> Hello, >> >> When you say "call [an instance of an object]", wh

Re: Managing a process from Django

2018-01-08 Thread Kasper Laudrup
Hi Antonis, On 2018-01-08 22:10, Antonis Christofides wrote: Hello, When you say "call [an instance of an object]", what exactly do you mean? Sorry, I meant an instance of a class or just an object. Could you tell us more about what this class/object is and why you need to "call" (access?)

Re: Managing a process from Django

2018-01-08 Thread Antonis Christofides
Hello, When you say "call [an instance of an object]", what exactly do you mean? Could you tell us more about what this class/object is and why you need to "call" (access?) it in an unusual way? Regards, Antonis Antonis Christofides http://djangodeployment.com On 2018-01-08 22:02, Kasper Lau

Re: Managing a process from Django

2018-01-08 Thread Kasper Laudrup
Hi again, So my question is more related to any kind of process that should be managed from a Django app. Django does not manages processes, Django is a web framework. Python can manage processes. What kind? Any :) I am fully aware of that, thank you :-) I guess my question is t

Re: Managing a process from Django

2018-01-08 Thread Matemática A3K
On Mon, Jan 8, 2018 at 2:41 PM, Kasper Laudrup wrote: > Hi Matemática A3K, > > On 2018-01-08 17:58, Matemática A3K wrote: > >> >> With this https://stackoverflow.com/questions/89228/calling-an-externa >> l-command-in-python >> you can find out which distribution is using, then for each distributi

Re: Managing a process from Django

2018-01-08 Thread Kasper Laudrup
Hi Matemática A3K, On 2018-01-08 17:58, Matemática A3K wrote: With this https://stackoverflow.com/questions/89228/calling-an-external-command-in-python you can find out which distribution is using, then for each distribution there's a different command for restarting DHCP (systemctl, upstart,

Re: Managing a process from Django

2018-01-08 Thread Matemática A3K
On Mon, Jan 8, 2018 at 12:48 PM, Kasper Laudrup wrote: > Hi fellow Django users, > > I'm working on creating a Django application for managing DHCP leases and > DNS entries and for that I would like to be able to (re)start the DHCP > daemon from Djano. > > I think it would be best to simply use a

Managing a process from Django

2018-01-08 Thread Kasper Laudrup
Hi fellow Django users, I'm working on creating a Django application for managing DHCP leases and DNS entries and for that I would like to be able to (re)start the DHCP daemon from Djano. I think it would be best to simply use a popen object from pythons subprocess module (most likely wrappe