On Sun, Sep 7, 2008 at 11:37 AM, Ian Bicking <[EMAIL PROTECTED]> wrote: > Lukasz Szybalski wrote: >>>> >>>> Should I maybe create folder inside of virtualenv called "etc" right >>>> next to "bin" or? >>>> What would be an easy way to reference it? "from >>>> some_pythonpath....import __file__" then connect the folders >>>> __file__+"etc"+config.xml? >>>> >>>> What would be a recommended way to do it? How would you do it? >>> >>> Is your configuration deployment-specific, or some kind of internal >>> configuration? If it's associated with the deployment, I would put it in >>> ENV/etc/myapp.xml, or ENV/etc/myapp/config.xml, i.e., not connected to >>> your >>> myapp source code. >> >> Its a deployment specific. It holds some defaults that user can change. >> How would I access ENV ?? from xyz import __file__ ? > > Generally you'd pass in the location of the configuration file from some > command-line that starts the script. You could try > os.path.join(print os.path.dirname(__main__.__file__) , 'etc', 'myapp', > 'config.xml') as well, if you want a default. __main__.__file__ should be > the location of the script.
Above will work nice when I have the file in /somepath/ENV/etc/myapp/config.xml and I load the configuration. How do I put the file there when I install it do? How from setup.py can I know where is my ENV (virtual environment?) is If I do python setup.py develop the following code will show current directory "print os.path.dirname(__main__.__file__)" . I guess what I want is the code that works in the same manner as setup() function and/or include_package_data = True which knows where site-package folder is. I want to know where my bin folder is? How can I find that out? Lucas _______________________________________________ Paste-users mailing list [email protected] http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users
