Reputation: 1016
For my Django project I had a script that worked with subprocess
to open the manage.py shell
and execute python code like that
proc = subprocess.Popen( [
manage, "shell",
], stdin=subprocess.PIPE)
proc.communicate(
"from django.contrib.auth.models import User; ..."
)
)
Now I'd like to do this with fabric
. How can I run manage.py shell
and put some code in there using fabric
?
Upvotes: 0
Views: 493
Reputation: 308789
Piping code to the manage shell looks very hacky.
I recommend you write a management command or a standalone script instead. Using fabric to run a script on a remote machine should be straight forward.
Upvotes: 1