[Fixed]-Starting Django virtual environment + build commands with gulp

1👍

you can use gulp-shell to run system command with gulp

install gulp-shell with npm:

$ npm install --save-dev gulp gulp shell

here is the sample gulpfile.js for your reference:

var gulp = require('gulp'),
    shell = require('gulp-shell');


gulp.task('default', shell.task([
    'git pull origin master',          // pull the latest data from remote repo
    'source $virtualenv/bin/activate; python manage.py dumpdata --database test > fixtures/data.json',   // activate the python virtual env, dump the data from test database
    'source $virtualenv/bin/activate; python manage.py loaddata fixtures/data.json'   // activate the python virtual env, load the data into production database
]));

Run gulp default task

$ gulp
👤Enix

Leave a comment