On Fri, Aug 19, 2011 at 2:46 PM, Kevin <[email protected]> wrote:
> Hello everyone,
>
>  Firstly, I've been using Django for quiet sometime now and have
> created a few projects and many of my websites run it.  I am wanting
> to take my Django management to the next level, and need to use the
> os.fork() function, here's why.
>
>  I am planning on developing a web control panel for managing Django
> instances in Django itself.  It only makes sense to make the control
> panel in Django.  It will contain models for managing the actually
> instances themselves and which users have control to them, and what
> permissions these users have.  Features I plan on putting into the
> control panel will be native Subversion support, using the Python
> Subversion libraries.

Hi Kevin,

Firstly, you don't want to be doing this with os.fork(). Subversion
has good Python bindings, so you can invoke Subversion calls directly
from within Python. The same is true of many other system functions.

Secondly, you don't want to be doing this with os.fork(). Web requests
are designed to be short lived. Putting an expensive system call in
the middle of a web request is a certain way to resource starvation.

What you want to do instead is use a service like Celery. When the
user requests a system function, you create a Job, and put it on a
celery queue to be satisfied. Creating a job is a very quick
operation, which means you can return control to the web request, and
the request can be returned to the user. Then, you set up a mechanism
to check when the job has completed -- for example, polling via an
AJAX call to get the result of the job, and displaying the result on
the page that was served when you created the job. Your web requests
remain short lived, and you don't lock up your web server.

Lastly, before you embark on a grand project like this, I would
suggest having a long look for prior art. You're not the first person
that has described this exact problem on django-users; I'd be deeply
surprised if there isn't *something* out there that will do at least
some of what you're describing.

Yours,
Russ Magee %-)

-- 
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.

Reply via email to