문제

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?

도움이 되었습니까?

해결책

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?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top