Hi, Thanks so much for your help; that enabled me to solve it. For convenience of anyone else, I did:
#Bring in pyramid application-------------------------------------- import pyramid from paste.deploy import appconfig config_file = '/path_to_config_file/configname.ini' name = 'app_name' config_name = 'config:%s' % config_file here_dir = os.getcwd() conf = appconfig(config_name, name, relative_to=here_dir) from main_package import main app = main(conf.global_conf, **conf.local_conf) #-------------------------------------------------------------------------- I agree that a documented official way to achieve this would be good, I searched for quite a while and did not come across the answer. Thanks again, Ben On 8 June 2011 11:26, Gael Pasgrimaud <[email protected]> wrote: > Hi, > > I guess that this thread already contain a reply: > > > http://groups.google.com/group/pylons-discuss/browse_thread/thread/fb1f4c49cf34eee2?hl=en# > > But I'm agree that this point should be added in the pyramid > documentation with a recommended way to do that. It's a common need > > -- > Gael > > On Tue, Jun 7, 2011 at 2:13 AM, somewhatofftheway > <[email protected]> wrote: > > I'm new to Pyramid and can't figure out how to do something which > > seems like it should be quite a common requirement. > > > > Basically, I want to write a script that will use the database models > > but will not need to do HTTP requests. The idea is that I can run it > > by cron or whatever. > > > > The equivalent in Pylons is answered here: > > > > > http://stackoverflow.com/questions/134387/run-pylons-controller-as-separate-app > > > > Could anybody assist and tell me if there is a simple way to achieve > > this? I have spent some time looking at Paster commands and the like > > but without success. > > > > Thanks, > > Ben > > > > -- > > 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. > > > > > > -- > 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. > > -- 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.
