Brandon N
woodsman at gmail.com
Thu Oct 27 21:48:30 EDT 2005
Hmm evidently you can send in gmail without actually hitting send... I meant seeing as others had pointed out the concern that one shouldn't put .py files under htdocs/ or similar directories for fear that someone might find access to one's source files, wholly intact. Though > In order for > Apache to make this determination, the .py files must be in the public > directories that Apache is managing. made it clear for me. Is that at all a security issue. Or rather, is there a standard method of referencing code outside of the public directories? On 10/27/05, Graham Dumpleton <grahamd at dscpl.com.au> wrote: > > Brandon N wrote .. > > I've checked out Vampire, and it would seem to be exactly that which I > > desire (after only a few minutes of experimentation at least). Does one > > typically include their .py files with this setup in the public > directory > > (with indexing and such disabled, naturally)? Or is there a way to > reference > > files outside of the public system? > > What do you mean by files? Do you mean the .py files which contain the > handlers or other Python helper modules, static files etc? > > In terms of how most mod_python extensions work, eg, Vampire, > mod_python.publisher etc, they rely on the fact that Apache performs the > mapping of URL to a physical file in the filesystem. Ie., they work out > what to do based on what Apache has set req.filename to. In order for > Apache to make this determination, the .py files must be in the public > directories that Apache is managing. Note though that this doesn't > mean they have to be physically under the main Apache document > root as you can use the Alias directive or symlinks and the FollowSymLinks > directive to locate them in different places but still appear under the > public > URL namespace. > > Anyway, if you can be clearer about what you mean, can possibly give > a better answer. :-) > > Graham > > > Thanks to the both of you with your help. It's cleared up a great deal > > for > > me. > > > > Cheers! > > > > On 10/27/05, Graham Dumpleton <grahamd at dscpl.com.au> wrote: > > > > > > Jorey Bump wrote .. > > > > Brandon N wrote: > > > > > A) Is it requestHandler's job to determine which file was > requested > > > and > > > > > respond accordingly (via the request's .filename?) with a switch > > > > > construct or equivalent? > > > > > > > > Yes and no. Apache's already passed the file to the handler based on > > its > > > > extension, presence in a directory, or other criteria. The developer > > of > > > > the handler gets to decide what the handler does with *whatever* is > > > > passed to it. Some assume it will contain only valid Python code and > > > > process it as such (mod_python.publisher, for example). Some might > > want > > > > to process proprietary or other file formats using python (you might > > > > make a handler to display Word files, for example), but remain > agnostic > > > > about the actual filename or extension. But there's no reason why > your > > > > handler can't branch according to the file extension (which is what > > > > Graham's Vampire does, if I'm not mistaken). > > > > > > If you are coming from a PHP background where each URL essentially > > > maps to a distinct file, Vampire may well be a good starting point as > > it > > > works in a similar way at it most basic level. > > > > > > Thus, where in PHP you might have: > > > > > > index.php # URL -> /index.php > > > search.php # URL -> /search.php > > > > > > Vampire would similarly have separate files for each resource, > although > > > in Vampire it is the name of the handler within the file which > dictates > > > what extension the URL needs to have: > > > > > > index.py > > > > > > def handler(req): ... # /index > > > def handler_html(req): ... # /index.html > > > def handler_php(req): ... # /index.php (Yes, pretend we are PHP when > > we > > > aren't). > > > > > > search.py > > > > > > def handler(req): ... # /search > > > def handler_html(req): ... # /search.html > > > > > > Thus, if you want to write your code in the form of basic handlers but > > a > > > distinct handler for each resource, the basic dispatch mechanism of > > > Vampire is going to allow you to get started quicker. > > > > > > Another alternative as Jorey pointed out is mod_python.publisher, > > > however it doesn't allow you to as easily dictate use of multiple > > > different extension types used on URLs nor is it necessarily as easy > > to > > > mix static files in the same directory. > > > > > > For a further basic introduction to Vampire, see: > > > > > > http://www.dscpl.com.au/projects/vampire/articles/vampire-001.html > > > > > > Graham > > > > > > > > > _______________________________________________ > > > Mod_python mailing list > > > Mod_python at modpython.org > > > http://mailman.modpython.org/mailman/listinfo/mod_python > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051027/f13e758f/attachment.html
|