The gulp task below, written in coffeescript, will launch the Django backend:
exec = require('child_process').exec
gulp.task 'serve:backend', ->
proc = exec 'source bin/activate; PYTHONUNBUFFERED=1 ./manage.py runserver'
proc.stderr.on 'data', (data) -> process.stdout.write data
proc.stdout.on 'data', (data) -> process.stdout.write data
You can run the task using gulp serve:backend
Note:
- You do not need to install any Node packages built-in child_process.
- exec spawn,
- stdout, stderr,
- PYTHONUNBUFFERED (grmbl)