Django: Como usar o Shell ?
Você usa o comando `django-shell` python manager.py shell na pasta do seu projeto para iniciar o Django Shell. O Django Shell é simplesmente um shell Python, mas com todo o código da sua aplicação já carregado. Portanto, você pode executar instruções Django, assim como instruções Python. Exemplo de sessão: bash $ python manage.py shell >>> from myapp.models import User >>> User.objects.all() <QuerySet [<User: Alice>, <User: Bob>]> >>> new_user = User(name= "Charlie" ) >>> new_user.save() python manage.py shell Python 3.9.5 (default, May 27 2021, 19:45:35) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> print('Hello world') Hello world >>> from polls.models import Question >>> q = Question(question_text='Hel...