Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Added current datetime as output in Django devserver as per ticket 18611 #236

Closed
wants to merge 1 commit into from

3 participants

Mike Grouchy Marc Tamlyn Claude Paroz
Mike Grouchy

thoughts?

django/core/management/commands/runserver.py
((5 lines not shown))
93 96
             "Django version %(version)s, using settings %(settings)r\n"
94 97
             "Development server is running at http://%(addr)s:%(port)s/\n"
95 98
             "Quit the server with %(quit_command)s.\n"
96 99
         ) % {
  100
+            "started_at": strftime('%B %d, %Y - %I:%M %p',
  101
+                            datetime.timetuple(datetime.now())),
2
Claude Paroz Owner
claudep added a note August 25, 2012

simpler: datetime.now().strftime(''%B %d, %Y - %X')

Mike Grouchy
mgrouchy added a note August 25, 2012

Much simpler, thanks for the feedback. Updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
django/core/management/commands/runserver.py
... ...
@@ -1,4 +1,6 @@
1 1
 from optparse import make_option
  2
+from datetime import datetime
  3
+from time import strftime
2
Marc Tamlyn Owner

This is now an unused import - strftime is a method of the datetime instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Mike Grouchy

Updated as per feedback from @mjtamlyn.

Marc Tamlyn
Owner

Looks good, I've marked the ticket as RFC.

Claude Paroz
Owner

Committed in cb1614f

Claude Paroz claudep closed this September 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
3  django/core/management/commands/runserver.py
... ...
@@ -1,4 +1,5 @@
1 1
 from optparse import make_option
  2
+from datetime import datetime
2 3
 import os
3 4
 import re
4 5
 import sys
@@ -90,10 +91,12 @@ def inner_run(self, *args, **options):
90 91
         self.stdout.write("Validating models...\n\n")
91 92
         self.validate(display_num_errors=True)
92 93
         self.stdout.write((
  94
+            "%(started_at)s\n"
93 95
             "Django version %(version)s, using settings %(settings)r\n"
94 96
             "Development server is running at http://%(addr)s:%(port)s/\n"
95 97
             "Quit the server with %(quit_command)s.\n"
96 98
         ) % {
  99
+            "started_at": datetime.now().strftime('%B %d, %Y - %X'),
97 100
             "version": self.get_version(),
98 101
             "settings": settings.SETTINGS_MODULE,
99 102
             "addr": self._raw_ipv6 and '[%s]' % self.addr or self.addr,
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.