list at joreybump.com
Sat Jul 3 13:20:38 EDT 2004
Nicolas Lehuen wrote: > > Jorey Bump wrote: > >>Automagic packaging could break a lot more than it fixes >>(you'd have to memorize every module or package in your path >>before creating directories). > > > Yeah, Jorey, I do understand that, it's trivial stuff ; my problem is that > mod_python.publisher seems to load all published modules in the top level > namespace. Sorry, I don't want to be too critical since mod_python is really > a nice achievement (very useful, especially when combined with the threaded > Apache2 implementation so that you can share data between threads), but you > don't have to lecture me on what is a namespace when the namespace issues > reside in mod_python.publisher. I'm sorry if I sounded pedantic. As your solution below indicates, this seems like more of an organizational problem than an indication of any deficiency in mod_python.publisher. I feel that mod_python behaves as expected when loading multiple applications into a single interpreter. The main reason I object to automagic packaging is that it would make it nearly impossible to develop large portions of the code outside of the Apache/mod_python environment, as I do now. Yes, there are some special precautions you have to take to ensure your applications will coexist, but your ordinary Python applications can benefit from this, as well. > But like I've just wrote, we can also keep the best parts of mod_python, put > away mod_python.publisher and use mod_python Servlets instead. Absolutely! It's almost impossible to avoid developing your own framework when using mod_python. As some of these mature, their authors will generously share them. This will only help to serve different programming styles. >>One solution is to create packages in your existing path. >>Anything you put in your installation's site-packages >>directory will be available to everyone on the system. In >>fact, that's why it was created. > > That's what I do right now, but I want to host many different applications > on my server (I have it configured in mass virtual hosting mode for that), > and I don't think it's a good practice to have the code for all my > applications available to every other application. That's why I wanted to do > something like this : > > $WWW/pythonlib/ --> code explicitely shared by all > applications > $WWW/hosts/host1/ --> virtual host 1 > $WWW/hosts/host1/pythonlib/ --> code shared by all apps and modules of > host1 > $WWW/hosts/host1/index.py --> redirects to the default application of > host1 > $WWW/hosts/host1/app1/ --> first application on host1 > $WWW/hosts/host1/app1/pythonlib/ --> code shared by all modules of > host1/app1 > $WWW/hosts/host1/app1/index.py --> default module of host1/app1 > ... > > In fact by reading this, I realise that by defining .htaccess files with > specific PythonInterpreter and PythonPath directives, I can do precisely > that plus get an healthy insulation of interpreters across applications (or > at least across hosts). I'll try this.