diff --git a/flask/cli.py b/flask/cli.py index 7e219f1e..6f85534d 100644 --- a/flask/cli.py +++ b/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="""\