Skip to content

Instantly share code, notes, and snippets.

@themartorana
Created February 13, 2011 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themartorana/824925 to your computer and use it in GitHub Desktop.
Save themartorana/824925 to your computer and use it in GitHub Desktop.
import os, subprocess, shlex
def start_kicker():
'''
Kick off Kicker and pass it our
sprocketize command-line argument
'''
try:
js_path = os.path.abspath(os.path.join(os.getcwd(), '../content/js'))
sprocketize = "sprocketize -C %s -I hae -I vendor hae.js > %s/sprockets.js" % (
js_path,
js_path
)
kicker = 'kicker -e "%s" %s' % (
sprocketize,
js_path
)
args = shlex.split(kicker)
p = subprocess.Popen(args)
return p
except Exception as ex:
print "Couldn't sprocketize"
print ex
def start_runserver():
'''
Start Django's runserver and wait for
it to exit
'''
args = shlex.split('python manage.py runserver_plus')
p = subprocess.call(args)
if __name__ == '__main__':
'''
Start kicker, start the
runserver, and when runserver
is killed off, kill off
Kicker as well
'''
k = start_kicker()
r = start_runserver()
if k:
k.kill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment