How do I start the pylons web application programmatically?
Normally, we start a pylons web application via command line:
pastser serve --reload development.ini
I wanna know can we start it programmaticly? In a python script file?
I want this because I ca开发者_开发技巧n start it in IDE, and use the debugger
#!/usr/bin/env python
from paste.script.serve import ServeCommand
ServeCommand("serve").run(["--reload", "development.ini"])
...some IDEs (e.g. pydev) won't support breakpoints in debug mode if you have --reload
enabled. Simply remove it from the list you pass to .run()
to disable the reload functionality and enable IDE breakpoints.
That sounds like a job for a shell script - you could launch it from a Python script, but a shell script is likely to be cheaper in terms of mental effort.
精彩评论