On Sep 29, 1:18 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 28-Sep-07, at 11:16 PM, Milan Andric wrote:
>
> > Is there some standard practice on a machine that has production code
> > running in mod_python but also has developers running their django-
> > python web server?  Is that discouraged?  I figure a regular user
> > would not share the same django with mod_python because of .pyc files
> > and permissions?  So developers would maintain separate django
> > installs.  This makes it difficult because then they can't develop
> > using the same python or need to override the library path?
>
> It is not advisable to do development on a production server. And
> django webserver is to be only used in development. There is no harm
> whatsover in running multiple sites using a common django install -
> and a common mod_python - as long as all the users are agreed on the
> version of django they are using. I run one server with one django
> which is on the svn head. I give the users 2 days notice before doing
> an svn up. Nothing prevents them from using their own version of
> django - but they all have to use the same apache and mod_python.

Allowing each user to use different versions of Python modules when
using mod_python to host multiple user sites is actually not a good
idea and can lead to problems. The specific problem that occurs in
allowing this is that Python only loads Python C extension modules
once per process. Thus if different users, whose Django instances are
running in different Python sub interpreters, trying to use different
versions of a C extension module, then the first to get their version
loaded first will win. Now when another user goes to use a different
version they will get the already loaded version rather than the one
they want. This can load to mismatches between the Python wrappers
around a C extension module and strange Python exceptions, or in the
worst case could cause crashes.

The only way one could safely host multiple users Django instances
where they are free to use different versions of Python modules, in
particular C extension modules, is to use mod_wsgi daemon mode,
mod_fastcgi or a mod_proxy solution. In other words, you cannot use a
mechanism where everything runs in the one process and only the use of
sub interpreters separates the application instances.

The other benefit of systems where the applications run in distinct
processes is that the users can control the reloading of their
application code themselves and not affect other users. This is
because they can force a restart of the daemon process for just their
application and they do not need to restart the whole of Apache.

For examples of how to use mod_wsgi daemon mode to keep the users
applications instances separate, look right down at bottom of:

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

Just apply this recipe for each VirtualHost container, just naming the
daemon process for each VirtualHost differently.

For example of how to setup different workingenv for each user in
their distinct daemon processes, see:

  http://docs.pythonweb.org/pages/viewpage.action?pageId=5439610

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