Opened 16 years ago
Closed 16 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)
Change History (5)
by , 16 years ago
Attachment: | current_time_at_validating.patch added |
---|
follow-up: 2 comment:1 by , 16 years ago
What problem does this solve that can't be solved in other ways?
comment:2 by , 16 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 , 16 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 , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.
Patch for django/core/management/commands/runserver.py