Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

3 participants

@mgrouchy

thoughts?

django/core/management/commands/runserver.py
((5 lines not shown))
"Django version %(version)s, using settings %(settings)r\n"
"Development server is running at http://%(addr)s:%(port)s/\n"
"Quit the server with %(quit_command)s.\n"
) % {
+ "started_at": strftime('%B %d, %Y - %I:%M %p',
+ datetime.timetuple(datetime.now())),
@claudep Collaborator
claudep added a note

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

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 @@
from optparse import make_option
+from datetime import datetime
+from time import strftime
@mjtamlyn Collaborator
mjtamlyn added a note

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

@mgrouchy
mgrouchy added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mgrouchy

Updated as per feedback from @mjtamlyn.

@mjtamlyn
Collaborator

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

@claudep
Collaborator

Committed in cb1614f

@claudep claudep closed this
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.
Showing with 3 additions and 0 deletions.
  1. +3 −0  django/core/management/commands/runserver.py
View
3  django/core/management/commands/runserver.py
@@ -1,4 +1,5 @@
from optparse import make_option
+from datetime import datetime
import os
import re
import sys
@@ -90,10 +91,12 @@ def inner_run(self, *args, **options):
self.stdout.write("Validating models...\n\n")
self.validate(display_num_errors=True)
self.stdout.write((
+ "%(started_at)s\n"
"Django version %(version)s, using settings %(settings)r\n"
"Development server is running at http://%(addr)s:%(port)s/\n"
"Quit the server with %(quit_command)s.\n"
) % {
+ "started_at": datetime.now().strftime('%B %d, %Y - %X'),
"version": self.get_version(),
"settings": settings.SETTINGS_MODULE,
"addr": self._raw_ipv6 and '[%s]' % self.addr or self.addr,
Something went wrong with that request. Please try again.