I am (attempting) to learn to develop on Django, and coming from a Node background wanted to keep Grunt in my workflow. I use stylus and coffeescript, and use Grunt to watch and precompile the files for me, plus other small tasks.
To keep things compact, I had included grunt-shell-spawn, and was using it to run the server with:
python manage.py runserver 0.0.0.0:8000
When I run this command from the command line by itself, I get full logging on requests, plus (more importantly) output from the print command. When I use grunt shell to handle this, the server loads and runs just fine, but I get no logging.
If there a way to get grunt / python to output the dev logging, as normal, when running the server via grunt?
THe full gruntfile for shell is:
shell: {
django: {
command: 'python manage.py runserver 0.0.0.0:8000',
options: {
stdout: true,
async: true
}
}
},
and then I am calling it from concurrent as:
concurrent: {
dev: {
tasks: ['shell:django', 'watch'],
options: {
logConcurrentOutput: true
}
}
}
Thanks!
Im assuming you want this stuff, the Django server logs that lists HTTP requests and django logger reports. Example from our app:
[02/19/2014 22:34:30] ERROR : Details : [ Client ]: Mozilla [ Username ]: meanjim [ Id ]: 8278
[19/Feb/2014 22:34:30] "POST /api/logcabin/ HTTP/1.1" 200 16
[19/Feb/2014 22:34:30] "GET /data/get_lesson_plan.json/ HTTP/1.1" 200 1366
So all you have to do is add the following attributes to the options object inside what you already have for shell:django.
options: {
stdout: true,
stdin: true,
stderr: true
}
Happy bug hunting friend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With