diff -r 86e9c4dac609 django/conf/__init__.py
a
|
b
|
|
110 | 110 | new_installed_apps.append(app) |
111 | 111 | self.INSTALLED_APPS = new_installed_apps |
112 | 112 | |
113 | | if hasattr(time, 'tzset'): |
| 113 | if hasattr(time, 'tzset') and hasattr(self, 'TIME_ZONE') and self.TIME_ZONE: |
114 | 114 | # Move the time zone info into os.environ. See ticket #2315 for why |
115 | 115 | # we don't do this unconditionally (breaks Windows). |
116 | 116 | os.environ['TZ'] = self.TIME_ZONE |
diff -r 86e9c4dac609 django/conf/project_template/settings.py
a
|
b
|
|
19 | 19 | # Local time zone for this installation. Choices can be found here: |
20 | 20 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
21 | 21 | # although not all choices may be available on all operating systems. |
| 22 | # On Unix systems you can leave it undefined or set it to None if |
| 23 | # you want the timezone to remain equal to the server's timezone. |
22 | 24 | # If running in a Windows environment this must be set to the same as your |
23 | 25 | # system time zone. |
24 | 26 | TIME_ZONE = 'America/Chicago' |
diff -r 86e9c4dac609 django/db/backends/postgresql/base.py
a
|
b
|
|
85 | 85 | def _cursor(self, settings): |
86 | 86 | set_tz = False |
87 | 87 | if self.connection is None: |
88 | | set_tz = True |
| 88 | set_tz = hasattr(settings, 'TIME_ZONE') and settings.TIME_ZONE |
89 | 89 | if settings.DATABASE_NAME == '': |
90 | 90 | from django.core.exceptions import ImproperlyConfigured |
91 | 91 | raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.") |
diff -r 86e9c4dac609 django/db/backends/postgresql_psycopg2/base.py
a
|
b
|
|
53 | 53 | def _cursor(self, settings): |
54 | 54 | set_tz = False |
55 | 55 | if self.connection is None: |
56 | | set_tz = True |
| 56 | set_tz = hasattr(settings, 'TIME_ZONE') and settings.TIME_ZONE |
57 | 57 | if settings.DATABASE_NAME == '': |
58 | 58 | from django.core.exceptions import ImproperlyConfigured |
59 | 59 | raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.") |
diff -r 86e9c4dac609 docs/settings.txt
a
|
b
|
|
1058 | 1058 | not necessarily the timezone of the server. For example, one server may serve |
1059 | 1059 | multiple Django-powered sites, each with a separate time-zone setting. |
1060 | 1060 | |
| 1061 | **New in Django development version:** This setting can also be left undefined |
| 1062 | or set to ``None`` for deployment scenarios in which you need the timezone to |
| 1063 | remain in the server's timezone. |
| 1064 | |
1061 | 1065 | Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you |
1062 | 1066 | specify in the ``TIME_ZONE`` setting. Thus, all your views and models will |
1063 | | automatically operate in the correct time zone. However, if you're using the |
1064 | | manual configuration option (see below), Django will *not* touch the ``TZ`` |
1065 | | environment variable, and it'll be up to you to ensure your processes are |
1066 | | running in the correct environment. |
| 1067 | automatically operate in the correct time zone. However, in the following two |
| 1068 | scenarios: |
| 1069 | |
| 1070 | * If you leave the ``TIME_ZONE`` setting undefined or set it to ``None`` |
| 1071 | * If you're using the manual configuration option (see below_) |
| 1072 | |
| 1073 | Django will *not* touch the ``TZ`` environment variable, and it'll be up to you |
| 1074 | to ensure your processes are running in the correct environment. |
1067 | 1075 | |
1068 | 1076 | .. note:: |
1069 | 1077 | Django cannot reliably use alternate time zones in a Windows environment. |
… |
… |
|
1133 | 1141 | purely for performance. |
1134 | 1142 | * Don't reinvent an already-existing setting. |
1135 | 1143 | |
| 1144 | .. _below: |
| 1145 | |
1136 | 1146 | Using settings without setting DJANGO_SETTINGS_MODULE |
1137 | 1147 | ===================================================== |
1138 | 1148 | |
… |
… |
|
1163 | 1173 | |
1164 | 1174 | Consequently, when configured via ``settings.configure()``, Django will not |
1165 | 1175 | make any modifications to the process environment variables. (See the |
1166 | | explanation of ``TIME_ZONE``, above, for why this would normally occur.) It's |
| 1176 | explanation of TIME_ZONE_, above, for why this would normally occur.) It's |
1167 | 1177 | assumed that you're already in full control of your environment in these cases. |
1168 | 1178 | |
1169 | 1179 | Custom default settings |