Home > other >  Solution: I don't know where I went wrong TypeError: the compile () takes two positional argume
Solution: I don't know where I went wrong TypeError: the compile () takes two positional argume

Time:05-14

TypeError ats/train/check_gw/
The compile () takes two positional arguments but 3 were given
The Request Method: GET
The Request URL: http://127.0.0.1:8000/train/check_gw/
Django Version: 3.1.6
The Exception Type: TypeError
The Exception Value:
The compile () takes two positional arguments but 3 were given
The Exception Location: D: \ \ project \ mydjango JCHEN \ python \ sql_server \ pyodbc \ compiler py, line 357, in the compile
The Python Executable: D: \ \ project \ mydjango JCHEN \ Python \ venv \ Scripts \ Python exe
Python Version: 3.9.0
Python Path:
[' D: \ \ JCHEN \ \ python \ \ project \ \ mydjango ',
'D: \ \ JCHEN \ \ python \ \ project \ \ mydjango',

'2020.2.3 \ \ \ \ plugins \ \ python helpers \ \ pycharm_display',
'E: \ \ Program Files \ \ Python39 \ \ Python39 zip',
'E: \ \ Program Files \ \ Python39 \ \ DLLs',
'E: \ \ Program Files \ \ Python39 \ \ lib',
'E: \ \ Program Files \ \ Python39',
'D: \ \ JCHEN \ \ python \ \ project \ \ mydjango \ \ venv',
'D: \ \ JCHEN \ \ python \ \ project \ \ mydjango \ \ venv \ \ lib \ \ site - packages',

'2020.2.3 \ \ \ \ plugins \ \ python helpers \ \ pycharm_matplotlib_backend']
Server time, Thu, 13 May 2021 07:20:07 + 0000
Error during the template rendering
The template In D: \ \ project \ mydjango JCHEN \ python \ "train" \ templates \ gw_list HTML, the error at the line 10

The compile () takes two positional arguments but 3 were given
1 & lt; ! DOCTYPE html>
2 & lt; HTML lang="en" & gt;
3 & lt; head>
4 & lt; Meta charset="utf-8" & gt;
5 & lt; title> {{title}} & lt;/title>
6 & lt;/head>
7 & lt; body>
8 & lt; H3 & gt; {{title}} & lt;/h3 & gt;
9 & lt; Table>
10 {% # prompt this line of code wrong
11.
12
13 & lt; Tr>
14 & lt; Th> {{i.d aihao}} & lt;/th>
15 & lt; Th> {{i.g angwei}} & lt;/th>
16 & lt;/tr>
17 {% endfor %}
18 & lt;/table>
19 & lt; br>
{% 20 if is_paginated %}

Urls. Py
The from the django. Urls import path
From the import views
From the views import check_gw
Urlpatterns=[
Check_gw path ('/', check_gw as_view (), name='check_gw'),


Models. Py
The from the django. Db import models
Class gangwei (models. Model) :
Daihao=models. CharField (max_length=5)
Gangwei=models. CharField (max_length=30)
Pth_file=models. CharField (max_length=60)
Rev=models. CharField (max_length=30)
Lasttime=models. DateTimeField (blank=True, null=True)
The class Meta:
Managed=False
Db_table='gangwei'


Views. Py
The class check_gw (ListView) :
The model=gangwei
Template_name='gw_list. HTML:'
Extra_context={' title ':' ability list directory '}
Queryset=gangwei. Objects. All ()
  • Related