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: docs/python/tutorial-django.md
+26-16Lines changed: 26 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -124,12 +124,12 @@ To create a minimal Django app, then, it's necessary to first create the Django
124
124
1. To verify the Django project, make sure your virtual environment is activated, then start Django's development server using the command `python manage.py runserver`. The server runs on the default port 8000, and you see output like the following output in the terminal window:
125
125
126
126
```bash
127
+
Watching for file changes with StatReloader
127
128
Performing system checks...
128
129
129
130
System check identified no issues (0 silenced).
130
-
131
-
January 15, 2021 - 14:33:31
132
-
Django version 3.1.5, using settings 'web_project.settings'
131
+
June 13, 2023 - 18:38:07
132
+
Django version 4.2.2, using settings 'web_project.settings'
133
133
Starting development server at http://127.0.0.1:8000/
134
134
Quit the server with CTRL-BREAK.
135
135
```
@@ -206,15 +206,24 @@ You're probably already wondering if there's an easier way to run the server and
206
206
207
207
```json
208
208
{
209
-
"name": "Python: Django",
210
-
"type": "python",
211
-
"request": "launch",
212
-
"program": "${workspaceFolder}/manage.py",
213
-
"args": [
214
-
"runserver",
215
-
],
216
-
"django": true
217
-
},
209
+
// Use IntelliSense to learn about possible attributes.
210
+
// Hover to view descriptions of existing attributes.
211
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
212
+
"version": "0.2.0",
213
+
"configurations": [
214
+
{
215
+
"name": "Python: Django",
216
+
"type": "python",
217
+
"request": "launch",
218
+
"program": "${workspaceFolder}\\manage.py",
219
+
"args": [
220
+
"runserver"
221
+
],
222
+
"django": true,
223
+
"justMyCode": true
224
+
}
225
+
]
226
+
}
218
227
```
219
228
220
229
This configuration tells VS Code to run `"${workspaceFolder}/manage.py"` using the selected Python interpreter and the arguments in the `args` list. Launching the VS Code debugger with this configuration, then, is the same as running `python manage.py runserver` in the VS Code Terminal with your activated virtual environment. (You can add a port number like `"5000"` to `args` if desired.) The `"django": true` entry also tells VS Code to enable debugging of Django page templates, which you see later in this tutorial.
@@ -317,12 +326,12 @@ Debugging gives you the opportunity to pause a running program on a particular l
317
326
1. Copy that line into the > prompt at the bottom of the debug console, and try changing the formatting:
318
327
319
328
```bash
320
-
now.strftime("%a, %d %B, %Y at %X")
321
-
'Fri, 07 September, 2018 at 07:46:32'
329
+
now.strftime("%A, %d %B, %Y at %X")
330
+
'Tuesday, 13 June, 2023 at 18:03:19'
322
331
now.strftime("%a, %d %b, %Y at %X")
323
-
'Fri, 07 Sep, 2018 at 07:46:32'
332
+
'Tue, 13 Jun, 2023 at 18:03:19'
324
333
now.strftime("%a, %d %b, %y at %X")
325
-
'Fri, 07 Sep, 18 at 07:46:32'
334
+
'Tue, 13 Jun, 23 at 18:03:19'
326
335
```
327
336
328
337
1. Step through a few more lines of code, if you'd like, then select Continue (`kb(workbench.action.debug.continue)`) to let the program run. The browser window shows the result:
@@ -388,6 +397,7 @@ In this section, you start by creating a single page using a template. In subseq
0 commit comments