Pipe it ;)
echo "print('hello world')" | python manage.py shell
Not like that. But it is easy enough to write a standalone script for Django.