[Cialug] Starting two jobs at once
Matthew Nuzum
newz at bearfruit.org
Tue Nov 27 14:35:47 CST 2012
Hi, in order to make development on projects easier I often automate common tasks with Makefiles. For example, a common work flow for a Python project is:
git clone project
cd project
make
make run
The makefile will generate a virtualenv, install project dependencies and create initial configuration files. Make run will start a temporary web server and keep it running so that I can work on the code and view the project in my browser.
As it turns out, some of my projects are getting more complex because instead of just launching a web server they might also need to launch more than one process to serve an app.
For example, I might need to run mongodb and the Django development server. I don't care about the output of mongodb, but I would like to see the output of the Django dev server. Or possibly want to run sass and have it watch files, compiling them whenever they change, and also run a nodejs app to serve content. Ideally, when I hit ctrl+c everything shuts down orderly.
Any suggestions on how to keep things simple and run a couple tasks at once?
Here is a simple example of a Makefile I use:
PIP=env/bin/pip
MANAGE=env/bin/python ./manage.py
all: build syncdb
syncdb:
$(MANAGE) syncdb --noinput
$(MANAGE) migrate
build:
$(PIP) install -r requirements.txt
run:
$(MANAGE) runserver 0.0.0.0:8000
--
Matthew Nuzum
newz2000 on freenode, skype, linkedin and twitter
♫ You're never fully dressed without a smile! ♫
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4136 bytes
Desc: not available
URL: <http://cialug.org/pipermail/cialug/attachments/20121127/e97167a4/attachment.bin>
More information about the Cialug
mailing list