Skip to content

Commit f0b12e4

Browse files
authored
Merge pull request #1878 from hjwp/helpful-not-re-timezone
Add a helpful note re: timezone formats
2 parents 019abeb + a262715 commit f0b12e4

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

en/django_start_project/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Let's make some changes in `mysite/settings.py`. Open the file using the code ed
7979

8080
**Note**: Keep in mind that `settings.py` is a regular file, like any other. You can open it from inside the code editor, using the "File -> Open" menu action. This should get you the usual window in which you can navigate to your `settings.py` file and select it. Alternatively, you can open the file by navigating to the `djangogirls/` folder on your desktop and right-clicking on it. Then, select your code editor from the list. Selecting the editor is important as you might have other programs installed that can open the file but will not let you edit it.
8181

82+
#### Changing the Timezone
83+
8284
It would be nice to have the correct time on our website. Go to [Wikipedia's list of time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) and copy your relevant time zone (TZ) (e.g. `Europe/Berlin`).
8385

8486
In `settings.py`, find the line that contains `TIME_ZONE` and modify it to choose your own timezone. For example:
@@ -88,6 +90,11 @@ In `settings.py`, find the line that contains `TIME_ZONE` and modify it to choos
8890
TIME_ZONE = 'Europe/Berlin'
8991
```
9092

93+
> **Note**: Timezones should be in the Region/City format, so eg "EDT" is not valid, but "America/Detroit" is.
94+
95+
96+
#### Changing the Language
97+
9198
A language code consist of the language, e.g. `en` for English or `de` for German, and the country code, e.g. `de` for Germany or `ch` for Switzerland. If English is not your native language, you can add this to change the default buttons and notifications from Django to be in your language. So you would have "Cancel" button translated into the language you defined here. [Django comes with a lot of prepared translations](https://docs.djangoproject.com/en/5.1/ref/settings/#language-code).
9299

93100
If you want a different language, change the language code by changing the following line:
@@ -98,16 +105,21 @@ LANGUAGE_CODE = 'de-ch'
98105
```
99106

100107

101-
We'll also need to add a path for static files. (We'll find out all about static files and CSS later in the tutorial.) Go down to the *end* of the file, and just underneath the `STATIC_URL` entry, add a new one called `STATIC_ROOT`:
108+
#### Other settings
109+
110+
We'll also need to add a path for static files.
111+
(We'll find out all about static files and CSS later in the tutorial.)
112+
Go down to the *end* of the file,
113+
and just underneath the `STATIC_URL` entry, add a new one called `STATIC_ROOT`:
102114

103115
{% filename %}mysite/settings.py{% endfilename %}
104116
```python
105117
STATIC_URL = 'static/'
106118
STATIC_ROOT = BASE_DIR / 'static'
107119
```
108120

109-
When `DEBUG` is `True` and `ALLOWED_HOSTS` is empty, the host is validated against `['localhost', '127.0.0.1', '[::1]']`. This won't
110-
match our hostname on PythonAnywhere once we deploy our application so we will change the following setting:
121+
When `DEBUG` is `True` and `ALLOWED_HOSTS` is empty, the host is validated against `['localhost', '127.0.0.1', '[::1]']`.
122+
This won't match our hostname on PythonAnywhere once we deploy our application so we will change the following setting:
111123

112124
{% filename %}mysite/settings.py{% endfilename %}
113125
```python

0 commit comments

Comments
 (0)