/ / Tutorial de introdução do Django - Invocar Python Shell - django

Django Intro Tutorial - Invoque o Python Shell - django

Eu sou novo no django e estou começando a passar pora documentação e o tutorial de enquete. Instalar etc não foi problema e cheguei a criar e ativar o modelo simples, mas agora estou tentando invocar o shell Python usando

python manage.py shell

mas continuo recebendo o erro abaixo a cada vez.

C:UsersOwnerDesktopProgrammingDjangmysite>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:python27libsite-packagesdjangocoremanagement__init__.py", line
399, in execute_from_command_line
utility.execute()
File "C:python27libsite-packagesdjangocoremanagement__init__.py", line
392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:python27libsite-packagesdjangocoremanagementbase.py", line 242,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:python27libsite-packagesdjangocoremanagementbase.py", line 285,
in execute
output = self.handle(*args, **options)
File "C:python27libsite-packagesdjangocoremanagementbase.py", line 415,
in handle
return self.handle_noargs(**options)
File "C:python27libsite-packagesdjangocoremanagementcommandsshell.py",
line 81, in handle_noargs
self.run_shell(shell=interface)
File "C:python27libsite-packagesdjangocoremanagementcommandsshell.py",
line 61, in run_shell
return getattr(self, shell)()
File "C:python27libsite-packagesdjangocoremanagementcommandsshell.py",
line 44, in ipython
ip()
File "C:python27libsite-packagesdjangocoremanagementcommandsshell.py",
line 37, in _ipython
from IPython import start_ipython
File "C:python27libsite-packagesIPython__init__.py", line 43, in <module>

from .config.loader import Config
File "C:python27libsite-packagesIPythonconfig__init__.py", line 16, in <
module>
from .application import *
File "C:python27libsite-packagesIPythonconfigapplication.py", line 29, i
n <module>
from IPython.external.decorator import decorator
File "C:python27libsite-packagesIPythonexternaldecorator__init__.py", l
ine 4, in <module>
from ._decorator import *
File "C:python27libsite-packagesIPythonexternaldecorator_decorator.py",
line 165
print("Error in generated code:", file=sys.stderr)
^
SyntaxError: invalid syntax

Agradeço antecipadamente por qualquer ajuda nisso, pois embora eu tenha alguma experiência em Python, estou achando muito difícil seguir o Traceback acima.

Respostas:

1 para resposta № 1

Você está usando uma biblioteca Python 3 (e não compatível com versões anteriores) com a versão Python 2.7. Você precisa reinstalar ipython para Python 2 (em C:python27) ou atualize para Python 3 (e instale ipython dentro C:python3)

Django é oficialmente compatível com Python 3 desde a versão 1.6.