Fixed #6682 -- Made shell's REPL actually execute $PYTHONSTARTUP and ~/.pythonrc.py.

Also:

* Added a ``--no-startup`` option to disable this behavior. Previous
  logic to try to execute the code in charge of this funcionality was
  flawed (it only tried to do so if the user asked for ipython/bpython
  and they weren't found)
* Expand ``~`` in PYTHONSTARTUP value.

Thanks hekevintran at gmail dot com  for the report and initial patch.

Refs #3381.
This commit is contained in:
Ramiro Morales 2013-01-24 21:21:26 -03:00
parent eaa716a413
commit 1f6b2e7a65
2 changed files with 27 additions and 9 deletions

View file

@ -779,6 +779,18 @@ bpython::
.. _IPython: http://ipython.scipy.org/
.. _bpython: http://bpython-interpreter.org/
When the "plain" Python interactive interpreter starts (be it because
``--plain`` was specified or because no other interactive interface is
available) it reads the script pointed to by the :envvar:`PYTHONSTARTUP`
environment variable and the ``~/.pythonrc.py`` script. If you don't wish this
behavior you can use the ``--no-startup`` option. e.g.::
django-admin.py shell --plain --no-startup
.. versionadded:: 1.6
The ``--no-startup`` option was added in Django 1.6.
sql <appname appname ...>
-------------------------