Opened 17 years ago

Closed 17 years ago

#7265 closed (fixed)

Add timestamp output to runserver when "Validating models..."

Reported by: Valera Grishin Owned by: nobody
Component: Tools Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is simple improvement to the Django development server available through "manage.py runserver" command. The goal is to add output of current time to the string "Validating models..."

So the proposition is to change this:

!#python
# django/core/management/commands/runserver.py:47

            print "Validating models..."

To this:

!#python
# django/core/management/commands/runserver.py

            print "[%s] Validating models..." % str(datetime.datetime.now())[11:19]

This will cause the output:

Validating models...

to to be similar to this:

[21:30:42] Validating models...

Obviously you need to import datetime at the top of file (not shown in the example above). Full patch is attached.

Attachments (1)

current_time_at_validating.patch (792 bytes ) - added by Valera Grishin <valery.grishin@…> 17 years ago.
Patch for django/core/management/commands/runserver.py

Download all attachments as: .zip

Change History (5)

by Valera Grishin <valery.grishin@…>, 17 years ago

Patch for django/core/management/commands/runserver.py

comment:1 by James Bennett, 17 years ago

What problem does this solve that can't be solved in other ways?

in reply to:  1 comment:2 by anonymous, 17 years ago

Replying to ubernostrum:

What problem does this solve that can't be solved in other ways?

This let's you see whether development server has reloaded after certain file has been changed.

Development server monitors the source files for the changes and reloads if any file has changed (i.e. saved in the editor). Reason for change is that server don't reload always. This is not the bug of the development server but rather changing the file that isn't monitored for certain reason.

Now assume you've edited and saved few source files in a row. Than you switch to development server console to check whether it reloaded. The timestamp near "Validating models..." will tell you exactly whether server has reloaded right now or you just seeing some former reloads (assume here you didn't request any pages in between the saves and reloads).

I've tried to find the way to the timestamp without touching the Django source codes but didn't succeeded.

comment:3 by anonymous, 17 years ago

In your settings.py file, put

import datetime
print str(datatime.datetime.now())

The settings file is reloaded every time the server restarts, so this will print the current day and time whenever the dev server restarts.

comment:4 by Valera Grishin, 17 years ago

Resolution: fixed
Status: newclosed

Thanks for the idea! Though it is better to put this output into the init.py instead of settings.py because the latter gets loaded more then once.
I'm closing the ticket.

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