Hi Chris, You said that your command line programs are using the same SQLAlchemy tables etc as your web-app, I'd like to know how you're handling configuration.
I ask because Ian Bicking and I are still formulating the ideas for how to handle scripts bundled with web-apps (for the same purpose, things to run from cron and whatnot) and manually parsing the pastedeploy config file with your own configparser is less than ideal, as is putting all of your configuration in the [app:main] section and copy-pasting boilerplate paste.deploy related source-code to get it to read that section the standard way. From an application developer's perspective, I'd ideally like to be able to write a config file that looks something like [DEFAULT] sqlalchemy.dburi = whatever log_settings = whatever [app:main] use = egg:whatever .. web-app related settings .. [script:do_something] use = app:main ... do_something script related settings .. then in my do_something script, import paste deploy and let it figure out my configuration which would get passed to my class's main or __init__ as app_conf, global_conf, which paste would know to override with whatever was given on the command-line. The command-line argument to config-file argument mapping scheme could be something simple like convert all underbars to hyphens so that log_file becomes --log-file. And finally, a function to kickstart the script could be written separately or whatever and listed in the setup.py as a standard setuptools console_scripts entry point. What do you think? Chris Shenton <[EMAIL PROTECTED]> writes: > "Shannon -jj Behrens" <[EMAIL PROTECTED]> writes: > >> On 2/5/07, Philip Jenvey <[EMAIL PROTECTED]> wrote: > >>> Your project's setup.py can call the setup function with a 'scripts' >>> argument. These scripts will be installed the the PREFIX/bin/ >>> directory. scripts is a standard distutils argument. > > >> Yep, I do this in my application. I don't put them in lib though. I >> create a top-level scripts directory. Then I add the following to >> setup.py: >> scripts=["scripts/myscript.py"], > > Thanks a bunch, this really helps. > -- David D. Smith
pgpIN9tOwT73M.pgp
Description: PGP signature
