NameError: name 'courses' is not defined
来源:11-2 课程列表页开发 - 2
qq_慕雪1070521
2022-08-03
D:\resources-master\resources\MxOnline\venv\Scripts\python.exe D:/resources-master/resources/MxOnline/manage.py runserver 8001
Performing system checks…
Watching for file changes with StatReloader
System check identified no issues (0 silenced).
August 03, 2022 - 21:28:20
Django version 2.2, using settings 'MxOnline.settings’
Starting development server at http://127.0.0.1:8001/
Quit the server with CTRL-BREAK.
[03/Aug/2022 21:30:35] “GET / HTTP/1.1” 200 29033
Not Found: /{% static 'js/deco-common.js
[03/Aug/2022 21:30:35] “GET /%7B%%20static%20’js/deco-common.js HTTP/1.1” 404 3437
[03/Aug/2022 21:30:35] “GET /static/images/logo.jpg HTTP/1.1” 304 0
Not Found: /{% static 'js/deco-common.js
[03/Aug/2022 21:30:36] “GET /%7B%%20static%20’js/deco-common.js HTTP/1.1” 404 3437
Not Found: /favicon.ico
[03/Aug/2022 21:30:36] “GET /favicon.ico HTTP/1.1” 404 3366
[03/Aug/2022 21:32:12] “GET / HTTP/1.1” 200 29033
Not Found: /{% static 'js/deco-common.js
[03/Aug/2022 21:32:12] “GET /%7B%%20static%20’js/deco-common.js HTTP/1.1” 404 3437
Not Found: /{% static 'js/deco-common.js
[03/Aug/2022 21:32:13] “GET /%7B%%20static%20’js/deco-common.js HTTP/1.1” 404 3437
Not Found: /{% static 'js/deco-common.js
[03/Aug/2022 21:32:13] “GET /%7B%%20static%20’js/deco-common.js HTTP/1.1” 404 3437
Not Found: /favicon.ico
[03/Aug/2022 21:32:20] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:21] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:21] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:22] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:22] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:23] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:24] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:24] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:25] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:25] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:26] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:27] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:27] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:28] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:28] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:29] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:30] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:30] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:31] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:31] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:32] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:33] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:33] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:34] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:34] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:35] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:36] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:36] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:37] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:38] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:38] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:39] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:39] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:40] “GET /favicon.ico HTTP/1.1” 404 3366
Not Found: /favicon.ico
[03/Aug/2022 21:32:41] “GET /favicon.ico HTTP/1.1” 404 3366
Internal Server Error: /course/list/
Traceback (most recent call last):
File “D:\resources-master\resources\MxOnline\venv\lib\site-packages\django\core\handlers\exception.py”, line 34, in inner
response = get_response(request)
File “D:\resources-master\resources\MxOnline\venv\lib\site-packages\django\core\handlers\base.py”, line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File “D:\resources-master\resources\MxOnline\venv\lib\site-packages\django\core\handlers\base.py”, line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “D:\resources-master\resources\MxOnline\venv\lib\site-packages\django\views\generic\base.py”, line 71, in view
return self.dispatch(request, *args, **kwargs)
File “D:\resources-master\resources\MxOnline\venv\lib\site-packages\django\views\generic\base.py”, line 97, in dispatch
return handler(request, *args, **kwargs)
File “D:\resources-master\resources\MxOnline\apps\courses\views.py”, line 10, in get
"all_courses":courses,
NameError: name ‘courses’ is not defined
[03/Aug/2022 21:32:41] “GET /course/list/ HTTP/1.1” 500 78339
请问怎么处理?
1回答
-
bobby
2022-08-10
这里提示很明确了,这行代码的courses没有定义这个变量
00
相似问题