Hi,
I am playing with the pylons framework and I have found something I
don't know how to do it. I would like to write a python script that
can access the models of my app, by I want to execute directly, not
through a controller. For example, I would like to have a crontab
process that perform s
On Sep 5, 2007, at 2:45 PM, neich wrote:
I am playing with the pylons framework and I have found something I
don't know how to do it. I would like to write a python script that
can access the models of my app, by I want to execute directly, not
through a controller. For example, I would like to
I answer myself:
#!/usr/local/bin/python2.4
from bolsa.websetup import *
setup_config('', '/path_to_your_apps/myapp/development.ini', '', '')
import myapp.model as model
q = model.Session.query(model.MyClass)
# ... do whatever yo want
model.Session.commit()
-
and don't forget to set
Thanks Ben,
That is exacltly what I have done. And I found the 'setup_config'
function that does what you explained.
> You'll need to know where your config ini file is, and load your app
> from the script. Your websetup.py script in your project should have
> code to do this (in 0.9.6 it does)