The pecan.commands module implements the pecan console script used to provide (for example) pecan serve and pecan shell command line utilities.
Bases: pecan.commands.base.BaseCommandParent
A base interface for Pecan commands.
Can be extended to support pecan command extensions in individual Pecan projects, e.g.,
$ pecan my-custom-command config.py
# myapp/myapp/custom_command.py
class CustomCommand(pecan.commands.base.BaseCommand):
'''
(First) line of the docstring is used to summarize the command.
'''
arguments = ({
'name': '--extra_arg',
'help': 'an extra command line argument',
'optional': True
})
def run(self, args):
super(SomeCommand, self).run(args)
if args.extra_arg:
pass
Bases: object
A base interface for Pecan commands.
Can be extended to support pecan command extensions in individual Pecan projects, e.g.,
$ pecan my-custom-command config.py
# myapp/myapp/custom_command.py
class CustomCommand(pecan.commands.base.BaseCommand):
'''
(First) line of the docstring is used to summarize the command.
'''
arguments = ({
'name': '--extra_arg',
'help': 'an extra command line argument',
'optional': True
})
def run(self, args):
super(SomeCommand, self).run(args)
if args.extra_arg:
pass
To be implemented by subclasses.
Bases: object
Used to discover pecan.command entry points.
Bases: object
Dispatches pecan command execution requests.
Serve command for Pecan.
Bases: wsgiref.simple_server.WSGIRequestHandler, object
A wsgiref request handler class that allows actual log output depending on the application configuration.
overrides the log_message method from the wsgiref server so that normal logging works with whatever configuration the application has been set to.
Levels are inferred from the HTTP status code, 4XX codes are treated as warnings, 5XX as errors and everything else as INFO level.
Bases: pecan.commands.base.BaseCommand
Serves a Pecan web application.
This command serves a Pecan web application using the provided configuration file for the server and application.
A very simple approach for a WSGI server.
The gunicorn_pecan command for launching pecan applications
Shell command for Pecan.
Bases: object
Open an interactive bpython shell with the Pecan app loaded.
Parameters: |
|
---|
Embed an interactive bpython shell.
Bases: object
Open an interactive ipython shell with the Pecan app loaded.
Parameters: |
|
---|
Embed an interactive ipython shell. Try the InteractiveShellEmbed API first, fall back on IPShellEmbed for older IPython versions.
Bases: object
Open an interactive python shell with the Pecan app loaded.
Parameters: |
|
---|
Embed an interactive native python shell.
Bases: pecan.commands.base.BaseCommand
Open an interactive shell with the Pecan app loaded. Attempt to invoke the specified python shell flavor (ipython, bpython, etc.). Fall back on the native python shell if the requested flavor variance is not installed.
Invokes the appropriate flavor of the python shell. Falls back on the native python shell if the requested flavor (ipython, bpython,etc) is not installed.
Load the model extension module
Load the pecan app, prepare the locals, sets the banner, and invokes the python shell.