Added support for PYTHONSTARTUP to shell command.
This commit is contained in:
parent
9bf36151d9
commit
662b1053a4
1 changed files with 12 additions and 1 deletions
13
flask/cli.py
13
flask/cli.py
|
|
@ -410,7 +410,18 @@ def shell_command():
|
|||
app.debug and ' [debug]' or '',
|
||||
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="""\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue