Le 01/06/2015 12:08, Chris Withers a écrit :
On 01/06/2015 08:11, Thierry Florac wrote:
Hi,
Do you want to create new management commands or do you just want to
get access to the shell?

Yes, I'm wondering if there's a framework for adding in new commands.

In that case, maybe you just want to look at this:

http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/commandline.html#writing-a-script

especially the lines:

from pyramid.paster import bootstrap
env = bootstrap('/path/to/my/development.ini')

From there you could/should add command-line arguments processing with Python's standard module argparse (https://docs.python.org/3.4/howto/argparse.html#id1)

And finally, as Veeti said, you should integrate your scripts with setuptools, i.e. declare them in your project's setup.py, so that the corresponding shellscripts are created.

You just need to do the work once, and reuse it for all subsequent scripts.

Laurent.

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to