On Jan 19, 8:00 am, appleseed249 <[email protected]> wrote:
> Hi all -
>
> I am building a site where users can register and deploy their own
> instances of Django. This isn't a public hosting site, just some
> distributed system work I'm doing for a class project.
> The Django instances are deployed on apache. I want to be able to
> dynamically add new Django instances without having to reload apache
> when a user signs up.
>
> This is my ideal setup:
>
> http://server.com/application/alice-> Alice's personal Django
> instancehttp://server.com/application/bob-> Bob's personal Django
> instancehttp://server.com/application/charles-> Charles' personal Django
> instance
> ...
>
> One solution is to manipulate the apache config files after a user
> creates an instance, but then I'd have to reload apache for this to
> take effect. I really don't want a configuration file with one
> <Location> directive per user account.
>
> The problem that I see is that each instance needs its own
> django.root, PythonPath, DJANGO_SETTINGS_MODULE and PythonInterpreter,
> as shown below:
>
> <Location "/application/bob">
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE bob.settings
> PythonOption django.root /bob
> PythonDebug On
> PythonPath "['/var/applications/bob/'] + sys.path"
> PythonInterpreter bob
> </Location>
>
> If the regex in LocationMatch were grouping, this would be trivial.
> But it doesn't appear to be.
>
> Anyway, if anyone has any ideas about how to get this working, it
> would be much appreciated.
Yes, don't use mod_python, use mod_wsgi instead.
Read up about:
AddHandler wsgi-script .wsgi
in:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive
This will have all Django instances running in same process and as
same user as Apache. If changes made to Django application code,
Apache still has to be restarted though as they are running in main
Apache child worker processes. This is the same situation as
mod_python.
Thus, you are better off using mod_wsgi daemon mode as then touching
the WSGI script file will cause application to be reloaded. Touching
one will though cause everyones to reload because still in same
process.
What you really need is a separate daemon process for each Django
instance which runs as the user who owns that Django instance. Right
now mod_wsgi doesn't support transient daemon processes that can be
configured in advance for unknown users, so a measure of
preconfiguration is still needed.
Anyway, have a look through mod_wsgi can then come back with what your
expectations are in respect of ability of individual users to reload
their Django instance and whether it should run as them or some common
user.
Graham
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---