Popular recipes by Nick Holden http://code.activestate.com/recipes/users/4177739/2011-04-20T13:22:49-07:00ActiveState Code RecipesPaster Run Script (Python) 2011-04-20T13:22:49-07:00Nick Holdenhttp://code.activestate.com/recipes/users/4177739/http://code.activestate.com/recipes/577669-paster-run-script/ <p style="color: grey"> Python recipe 577669 by <a href="/recipes/users/4177739/">Nick Holden</a> (<a href="/recipes/tags/script/">script</a>). </p> <p>If you are like me and your company has a custom piece of software for managing processes, you have your paster app installed in egg form in a virtualenv, then you might have a hard time running a paster server (turbogears 2) within those limits.</p> <p>As I had so much trouble writing this I thought I would share. You can add this as a console script in your egg, then run it as --prod or --dev. When run as --prod it adds a signal handler so that if it is sigtermed by the "supervisor" program then it will kill off the rest of the paster processes (they usually don't get stopped if the main running process is killed).</p> <p>The script is pretty rough and expects the production.ini to be in your package's main folder, with the development.ini being in the same directory as the setup.py (one directory above the production.ini). Make sure you change my_paster_package to be whatever your project is called, like "movies" from the turbogears example</p> <p>Of course if someone has a better way of doing this that would be great too! (wsgi isn't an option for me, and it seems difficult to set it up when your project is installed as an egg)</p>