1

Is that possible to not show output for static folder in terminal where django runs?

Sometime I need to output some debug data. And I need to scroll on top to see it.

I'm running multiple servers like solr, celery on both side, redis and using tmux to organise terminal windows. And it is kind of pain to jump between different window just to see my prints.

It would be much enjoyable to see just request that I need instead of this garbage:

[17/Dec/2012 15:02:04] "GET /static/stylesheets/screen.css?c37d260fd09cc901ba8a3c368e3c888b75b61609 HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/js/compressed.js?79917cdacff0725b658d1af00ad192f77f61e880 HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/css/all.css?c6cefe9dda47c84cd6a931b2a3d0f3b0528ee286 HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/js/keyboard.js?77b4a72c5a8a35714276a7addf50bb959d036b11 HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/css/keyboard.css HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/css/imageflow.css HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/js/jquery-1.6.4.min.js HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/js/jquery-ui-1.8.16.custom.min.js HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/bg-intro.gif HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/bg-inner-content-c-onecolumn.png HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/bg-tabset.gif HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/bg-main.jpg HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/menu_kanali_back.gif HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/bg_country_year_filters.png HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/path_kanali_back.gif HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/btn_hide_countries_groups.png HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/btn_apply_changes.png HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/bg-inner-content-b-onecolumn.png HTTP/1.1" 304 0
[17/Dec/2012 15:02:04] "GET /static/images/kak_smotret_footer.jpg HTTP/1.1" 304 0
Pol
  • 24,517
  • 28
  • 74
  • 95

2 Answers2

3

I think that grep may help you:

python ./manage.py runserver 3>&1 1>&2 2>&3 3>&- | grep -v static

The idea is to use grep to return lines that do not match a given pattern

Here is an explanation on how pipe only stderr through a filter

Community
  • 1
  • 1
furins
  • 4,979
  • 1
  • 39
  • 57
  • Yep, it does not work. But I've got the idea. Thanks. I forgot about grep =) – Pol Dec 17 '12 at 20:32
  • You're welcome! :) I used a regex but using "grep -v static" you should get more or less the same result and it's easier to remember. – furins Dec 17 '12 at 20:36
  • I understood why it did not work. The message was rendered to stderr not stdout. I edited my answer – furins Dec 17 '12 at 21:18
1

Perhaps not exactly what you want but it may be good enough:

https://github.com/tomchristie/django-pdb

Using that will halt django when needed. For example before loading a view etc.