On 2/5/07, David Smith <[EMAIL PROTECTED]> wrote: > 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?
I was about to ask the same thing. I normally have a bin/ directory in my applications for command-line administrative tasks. I do NOT want these merged into the global bin/ directory; I want them to stay with the application. Either because they've been copied from another application and slightly modified but still have the same name, or because they're ad hoc or temporary. And also so I don't have to remember, "What's this 'foo' and which application does it belong to? I haven't figured out how to do that with eggs; just register them as "extra files"? I do have a .pth in the global site-packages pointing to the app's lib directory. Sometimes a site-wide program requires access to every application's libraries and config (e.g., to do a backup or logging reports). Not sure what "setuptools console_scripts entry point" is. Is that a setup.py command? I could use setup.py commands for my utilities, but there are likely to be a lot of them and some will be ad hoc, not something you'd want to link to setup.py if you don't have to. Plus, if you really install the egg properly (which I'm only half convinced is worthwhile), there will be no setup.py on the server. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
