Browse Source

Added support for PYTHONSTARTUP to shell command.

pull/1161/head
Armin Ronacher 10 years ago
parent
commit
662b1053a4
  1. 13
      flask/cli.py

13
flask/cli.py

@ -410,7 +410,18 @@ def shell_command():
app.debug and ' [debug]' or '', app.debug and ' [debug]' or '',
app.instance_path, app.instance_path,
) )
code.interact(banner=banner, local=app.make_shell_context()) ctx = {}
# Support the regular Python interpreter startup script if someone
# is using it.
startup = os.environ.get('PYTHONSTARTUP')
if startup and os.path.isfile(startup):
with open(startup, 'r') as f:
eval(compile(f.read(), startup, 'exec'), ctx)
ctx.update(app.make_shell_context())
code.interact(banner=banner, local=ctx)
cli = FlaskGroup(help="""\ cli = FlaskGroup(help="""\

Loading…
Cancel
Save