You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/django_start_project/README.md
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,8 @@ Let's make some changes in `mysite/settings.py`. Open the file using the code ed
79
79
80
80
**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.
81
81
82
+
#### Changing the Timezone
83
+
82
84
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`).
83
85
84
86
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
88
90
TIME_ZONE='Europe/Berlin'
89
91
```
90
92
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
+
91
98
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).
92
99
93
100
If you want a different language, change the language code by changing the following line:
@@ -98,16 +105,21 @@ LANGUAGE_CODE = 'de-ch'
98
105
```
99
106
100
107
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`:
102
114
103
115
{% filename %}mysite/settings.py{% endfilename %}
104
116
```python
105
117
STATIC_URL='static/'
106
118
STATIC_ROOT=BASE_DIR/'static'
107
119
```
108
120
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:
0 commit comments