Opened 7 years ago

Closed 6 years ago

Last modified 4 years ago

#6385 closed (duplicate)

Make runserver output colorful HTTP status codes

Reported by: Rob Hudson <treborhudson@…> Owned by: nobody
Component: django-admin.py runserver Version: master
Severity: Keywords: color
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

While developing locally and using the built-in server, it is helpful to be able to quickly scan and see 404s, redirects, errors, etc. The attached diff adds 4 HTTP colors for each of the HTTP status codes of 2xx, 3xx, 4xx, and 5xx.

Attachments (3)

colorize.diff (2.1 KB) - added by Rob Hudson <treborhudson@…> 7 years ago.
Add HTTP colors to runserver output
color_status_codes.png (6.4 KB) - added by Rob Hudson <treborhudson@…> 7 years ago.
PNG showing output from runserver
0021-Colorize-HTTP-server-log-output.patch (2.7 KB) - added by Bastian Kleineidam <calvin@…> 7 years ago.
split off coloring in a separate function

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by Rob Hudson <treborhudson@…>

Add HTTP colors to runserver output

comment:1 Changed 7 years ago by Rob Hudson <treborhudson@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

PS: This is similar to #1491. I'll also attach a screenshot of it in action.

Changed 7 years ago by Rob Hudson <treborhudson@…>

PNG showing output from runserver

comment:2 Changed 7 years ago by Simon Greenhill <dev@…>

  • Triage Stage changed from Unreviewed to Design decision needed

Changed 7 years ago by Bastian Kleineidam <calvin@…>

split off coloring in a separate function

comment:3 Changed 6 years ago by russellm

  • milestone set to 1.2
  • Triage Stage changed from Design decision needed to Accepted

The most recent patch is a good start; here are a few comments:

1) I'd rather see the whole line colorized - not just the status code.

2) 2XX is a normal success - I'd argue that shouldn't have any colorization. The 3XX case is worth noting (and worth being easy to see), but it probably doesn't need to be bold. The 4XX and 5XX cases are both bad, and should be bold, and in warning colors (yellow/red))

3) Blue is a really bad choice of color for 3XX - its almost invisible on a black background. Green would be a better choice

4) I'd rather see this display code isolated to the development server. By putting it in basehttp, every single Django server will be colorizing - even if that colorization is a no-op. This is an overhead that the dev server can wear, but we shouldn't force onto every WSGI/mod_python/fcgi.


comment:4 Changed 6 years ago by russellm

  • Resolution set to duplicate
  • Status changed from new to closed

Marking as a duplicate of #7679.

comment:5 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top