Question

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?

Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top