On Jun 27, 12:59 am, "Vladimir Pouzanov" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm running several django sites on lighttpd server. Sites are simple
> and I don't like the idea of spawning so much python processes that
> eat my precious memory. Is it possible somehow to run several sites in
> one fcgi server?

AFAIK the answer is no.

This is because all fcgi server side infrastructure packages I have
seen all use standard Python executable. As a consequence this means
that the process can only hold one Django application instance. Only
one Django instance is possible because Django relies on getting
information from os.environ for location of settings file and there is
only one os.environ per process. There would also possibly be other
problems as well if Django or your applications hold information in
global data. A further problem is where people set the Python path to
include the site directory as well as the parent, as then modules may
clash due to a lack of site specific prefix in package name.

That all said. My understanding of mod_fastcgi is that you can attach
fcgi scripts against different URLs in same host or different virtual
hosts. The result would be multiple fcgi process with one Django
instance in each. Thus, there probably isn't a need to run two Django
instances in the same process with fcgi, just run multiple fcgi
process.

The only solution which would allow you to run multiple Django
instances in a single process, but not where that is in the Apache
child processes, is mod_wsgi. In mod_wsgi it can be used in 'embedded'
mode whereby it runs like mod_python with application running in child
processes. Or it can be used in 'daemon' mode whereby the application
is delegated to run in a distinct daemon process like with fcgi
solutions. With mod_wsgi however, it gives you the choice of running
one or more Django instances in a single daemon process, each in a
separate sub interpreter.

The Django documentation for mod_wsgi doesn't yet show an example of
daemon processes being used, but Trac documentation does, although in
that case only one Trac instance is put in each daemon process,
something which would be preferred with Django as well for reasons
described in the Trac integration documentation.

For further details see:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac
  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Graham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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