[mod_python] Physical paths ?

S.R.Pardá linux at qbox.es
Fri Feb 1 06:05:43 EST 2008


Now, thank you to your help,  my applicattion is capable of receive
image files from users using forms.
And app store them into a physical path of the server. 

It's possible to save from the app to an uri folder ? 

Can I know the physical path of one uri ? 

I can save easily to a subfolder of the pyhsical path obtained by
req.filename relative to the page visited, and that can work without

But I would like the module (the module that implements the form
proccesing) receive the relative route relative to the root of the
application path, so module will not need to know the physical structure
of directories, and can save to a route not descendent of the directory
of my own page.

... And in my app, the root of the app is a directory alias. outside of
the apache document_root '/var/www' 

That's it

	DocumentRoot 	/	      /var/www

	Alias		MyApp	      /home/user/MyApp/

	/MyApp/index.psp   .......... /home/user/MyApp/index.psp

	/MyApp/config/upload.psp  ... /home/user/MyApp/config/index.psp

	/MyApp/images/	............. /home/user/MyApp/images/
	/MyApp/images/users/	..... /home/user/MyApp/images/users/

And I want to obtain from code executed in 


the physical path of root of the application:


so I can't sent to a function in form.py:

	app_root = ??? 	  # function that returns '/home/user/MyApp/'
	imgs_folder = 'images/users/'

	process(form, directory_to_save = app_root+imgs_folder)

So, the code is independent of the installation directory and the app

Another thing ... if images would be an alias, ¿ could I know the path ?

Thank You again.


More information about the Mod_python mailing list