[mod_python] Physical paths ?

Graham Dumpleton graham.dumpleton at gmail.com
Fri Feb 1 16:36:09 EST 2008


I think I only partly understand what you want. Anyway, work out what
the following would do if done in your mod_python handler.

  import os
  req.application_root = os.path.dirname(__file__)

Graham

On 01/02/2008, S.R.Pardá <linux at qbox.es> wrote:
> Hi,
>
> 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
> problem.
>
>
> 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
>
>         http:/MyApp/config/upload.psp
>
> 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
> path.
>
> Another thing ... if images would be an alias, ¿ could I know the path ?
>
>
>
>
> Thank You again.
>
>         S.R.Parda
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list