Django_app

Django process management.

Use this module to run a django app.

Classes

class servermgr.django_app.Manager(host, port, settings, **kwargs)[source]

Django manager object.

Parameters:
  • host – the interface to listen on.
  • port (int) – the port to listen on.
  • settings – name of the django settings module
  • name – the program name
  • process_name – the string to diplay in ‘ps’
health()[source]

Check the health of the django subprocess.

Raises :base.WorkerError if we cannot create a socket connection to app.
static launch(**kwargs)[source]

Launch a django app in a fresh python environment.

Parameters:
  • host – the fcgi listener interface
  • port (int) – the fcgi listener port
  • process_name – the displayed program name;
Settings :

the django settings module name;

ready_wait(timeout=10.0, verbose=False)

Wait until the worker subprocess is responding to requests.

Parameters:
  • timeout (float, seconds) – Give the server this many seconds to start. If the timeout expires before the server has started, kill the server and raise WorkerError.
Raises :

WorkerError if the worker is not ready within the time limit.

Raises :

WorkerError if there is no subprocess.

start(wait=True, timeout=10.0)[source]

Start the Django app in its own process.

Parameters:
  • wait – If true, call self.ready_wait() after starting the subprocess.
  • timeout (float, number of seconds) – When calling ready_wait(), use this timeout value.
Raises :

base.WorkerError if the worker hasn’t started before timeout elapses.

stop(wait=True)

Terminate the worker subprocess.

Parameters:
  • wait (boolean) – If True, wait for the worker to exit.
wait()

Wait for the worker process to exit.

Running django_app.py

servermgr.django_app.main()[source]

main routine.

Table Of Contents

Previous topic

Postgres

Next topic

Pyro

This Page