Run Django dev server with Gulp

This is basically an extract from this excellent article by Caktus Group’s Calvin Spealman.

If you want to be able to change Django dev server’s IP and port, use Calvin’s code in the article. My snippet is rather simplified:

# gulpfile.js
var spawn = require('child_process').spawn;

gulp.task('default', function() {
    var runserver = spawn(
        process.env['VIRTUAL_ENV'] + '/bin/python',
        ['', 'runserver'], 
        { stdio: 'inherit' }
    runserver.on('close', function(code) {
        if (code !== 0) {
            console.error('Django runserver exited with error code: ' + code);
        } else {
            console.log('Django runserver exited normally.');
This entry was posted in How to’s and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *