[Answered ]-How to automate django dumpdata?

0👍

Since ‘$ source’ was the thing that could not be executed. I made a shell script, placed it in a directory and just executed that

source pathto/pyenv/bin/activate && python manage.py dumpdata quiz > data_dump/foo.json
source pathto/pyenv/bin/activate && python manage.py dumpdata main > data_dump/bar.json
source pathto/pyenv/bin/activate && python manage.py dumpdata study > data_dump/waz.json

and then in the fabric file…

def foobar():
    local('/pathto/foo.sh')     
👤Joff

2👍

Your script executes under the classic sh shell, not under bash. “source” is a bash command; the classic import command is a period (like “. pathto/pyenv/bin/activate”). Or you could force bash with #!/bin/bash at the start of your script.

👤Skrop

Leave a comment