diff -r e7e8eff2050e django/conf/__init__.py
|
a
|
b
|
class Settings(object):
|
| 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 e7e8eff2050e django/conf/project_template/settings.py
|
a
|
b
|
DATABASE_PORT = '' # Set to
|
| 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 e7e8eff2050e django/db/backends/postgresql/base.py
|
a
|
b
|
class DatabaseWrapper(BaseDatabaseWrappe
|
| 82 | 82 | def _cursor(self, settings): |
| 83 | 83 | set_tz = False |
| 84 | 84 | if self.connection is None: |
| 85 | | set_tz = True |
| | 85 | set_tz = hasattr(settings, 'TIME_ZONE') and settings.TIME_ZONE |
| 86 | 86 | if settings.DATABASE_NAME == '': |
| 87 | 87 | from django.core.exceptions import ImproperlyConfigured |
| 88 | 88 | raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.") |
diff -r e7e8eff2050e django/db/backends/postgresql_psycopg2/base.py
|
a
|
b
|
class DatabaseWrapper(BaseDatabaseWrappe
|
| 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 e7e8eff2050e docs/settings.txt
|
a
|
b
|
not necessarily the timezone of the serv
|
| 1030 | 1030 | not necessarily the timezone of the server. For example, one server may serve |
| 1031 | 1031 | multiple Django-powered sites, each with a separate time-zone setting. |
| 1032 | 1032 | |
| | 1033 | This setting can also be left undefined or set to ``None`` for deployment |
| | 1034 | scenarios in which you need the timezone to remain in the server's timezone. |
| | 1035 | |
| 1033 | 1036 | Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you |
| 1034 | 1037 | specify in the ``TIME_ZONE`` setting. Thus, all your views and models will |
| 1035 | | automatically operate in the correct time zone. However, if you're using the |
| 1036 | | manual configuration option (see below), Django will *not* touch the ``TZ`` |
| 1037 | | environment variable, and it'll be up to you to ensure your processes are |
| 1038 | | running in the correct environment. |
| | 1038 | automatically operate in the correct time zone. However, Django will *not* |
| | 1039 | touch the ``TZ`` environment variable, and it'll be up to you to ensure your |
| | 1040 | processes are running in the correct environment in the following two scenarios: |
| | 1041 | |
| | 1042 | * If you leave the ``TIME_ZONE`` setting undefined or set it to ``None`` |
| | 1043 | * If you're using the manual configuration option (see below_) |
| 1039 | 1044 | |
| 1040 | 1045 | .. note:: |
| 1041 | 1046 | Django cannot reliably use alternate time zones in a Windows environment. |
| … |
… |
Django apps. Just follow these conventio
|
| 1105 | 1110 | purely for performance. |
| 1106 | 1111 | * Don't reinvent an already-existing setting. |
| 1107 | 1112 | |
| | 1113 | .. _below: |
| | 1114 | |
| 1108 | 1115 | Using settings without setting DJANGO_SETTINGS_MODULE |
| 1109 | 1116 | ===================================================== |
| 1110 | 1117 | |
| … |
… |
application.
|
| 1135 | 1142 | |
| 1136 | 1143 | Consequently, when configured via ``settings.configure()``, Django will not |
| 1137 | 1144 | make any modifications to the process environment variables. (See the |
| 1138 | | explanation of ``TIME_ZONE``, above, for why this would normally occur.) It's |
| | 1145 | explanation of TIME_ZONE_, above, for why this would normally occur.) It's |
| 1139 | 1146 | assumed that you're already in full control of your environment in these cases. |
| 1140 | 1147 | |
| 1141 | 1148 | Custom default settings |