mirror of
https://github.com/django/django.git
synced 2025-06-06 12:09:11 +00:00
Fixed #8702 -- Set up the initial locale correctly for the development server.
Previously, "--noreload" wasn't picking up the default language setting. Thanks to arien and Karen Tracey for debugging this. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
15644cb255
commit
1729d92f71
@ -43,11 +43,18 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def inner_run():
|
def inner_run():
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.utils import translation
|
||||||
print "Validating models..."
|
print "Validating models..."
|
||||||
self.validate(display_num_errors=True)
|
self.validate(display_num_errors=True)
|
||||||
print "\nDjango version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE)
|
print "\nDjango version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE)
|
||||||
print "Development server is running at http://%s:%s/" % (addr, port)
|
print "Development server is running at http://%s:%s/" % (addr, port)
|
||||||
print "Quit the server with %s." % quit_command
|
print "Quit the server with %s." % quit_command
|
||||||
|
|
||||||
|
# django.core.management.base forces the locale to en-us. We should
|
||||||
|
# set it up correctly for the first request (particularly important
|
||||||
|
# in the "--noreload" case).
|
||||||
|
translation.activate(settings.LANGUAGE_CODE)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
path = admin_media_path or django.__path__[0] + '/contrib/admin/media'
|
path = admin_media_path or django.__path__[0] + '/contrib/admin/media'
|
||||||
handler = AdminMediaHandler(WSGIHandler(), path)
|
handler = AdminMediaHandler(WSGIHandler(), path)
|
||||||
@ -70,6 +77,7 @@ class Command(BaseCommand):
|
|||||||
if shutdown_message:
|
if shutdown_message:
|
||||||
print shutdown_message
|
print shutdown_message
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if use_reloader:
|
if use_reloader:
|
||||||
from django.utils import autoreload
|
from django.utils import autoreload
|
||||||
autoreload.main(inner_run)
|
autoreload.main(inner_run)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user