I use this at the beggining of my python external script:
--------------
from paste.deploy import appconfig
from pylons import config
sys.path.append('/absolute/path/myapp')
from myapp.config.environment import load_environment
filename = '/absolute/path/myapp/development.ini'
conf = appconfig('config:' + filename)
load_environment(conf.global_conf, conf.local_conf)
from myapp import model
----------------
Replace myapp by your app name and it should work. Is there a more
elegant way to do it ? This seemed to me like a sort of a hack ...
Nacho
2007/11/21, Max Ischenko <isch...@public.gmane.org>:
On Nov 21, 2007 5:52 AM, Ian Bicking
<ianb...@public.gmane.org> wrote:
Konstantin Alexandrov wrote:
Hello all.
I need to use my Pylons project's environment (config, models etc) from
external script launched by cron.
How to do that?
If you use PasteScript trunk, you can do "paster request config.ini
/cron", which runs a request to /cron.
If you are not using PasteScript trunk you can still use paster "
paste.paster_command" extensions point. Quite verbose but it works.