Python / Django shell not starting

One of the great features of Django is that you can open the python interpreter setup for use with your project. This can be used to analyze objects in the database and allows you to execute any python commands in your project. I consider it necessary for the development of Django. It is called in the project directory using the following command:

$ python manage.py shell 

I just started developing a new project and for some reason the shell does not work. I searched online for an error and found nothing. I would really appreciate any help with this error:

 Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager utility.execute() File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 222, in execute output = self.handle(*args, **options) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 351, in handle return self.handle_noargs(**options) File "/Library/Python/2.6/site-packages/django/core/management/commands/shell.py", line 29, in handle_noargs shell = IPython.Shell.IPShell(argv=[]) AttributeError: 'module' object has no attribute 'Shell' 

Thanks in advance for your help!

+6
python django shell
source share
2 answers

It seems that IPython is not installed correctly. Try starting the shell with:

 ./manage.py shell --plain 

to run the standard Python shell, not IPython. If this works, try uninstalling IPython completely and reinstalling it.

+12
source share

IPython 0.11 has a different API for which a fix exists in recent versions of Django.

For older versions of Django, you can use IPython 0.10, which works:

 pip install ipython==0.10 
+6
source share

All Articles