0

I wanna ask how to make a "python manage.py shell" and add a "from myapp.model import Contact c = Contact.objects.all().count() print c". Is this possible in a batch file?

Nethan
  • 251
  • 1
  • 6
  • 18

1 Answers1

2

Try something like:

echo "from myapp.model import Contact; c = Contact.objects.all().count(); print c" | python manage.py shell

Or this How do you read from stdin in Python?

Community
  • 1
  • 1
Medhat Gayed
  • 2,585
  • 20
  • 12