python-django ORM 很奇怪的问题,

(这个表名是django自动组合成的,但是我自定义的有名称。数据库里就是我自定义的名字)
python-django ORM 很奇怪的问题,
定义model 的表名(相当于这个db_table字段不生效,这个文件下其他表都生效,就这一个表)
python-django ORM 很奇怪的问题,
数据库中的表名
python-django ORM 很奇怪的问题,

还望各位大佬 不吝赐教

log :

Traceback (most recent call last):
File "D:\clearn\lib\site-packages\django\db\backends\utils.py", line 84, in _execute

return self.cursor.execute(sql, params)

File "D:\clearn\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute

return self.cursor.execute(query, args)

File "D:\clearn\lib\site-packages\MySQLdb\cursors.py", line 206, in execute

res = self._query(query)

File "D:\clearn\lib\site-packages\MySQLdb\cursors.py", line 319, in _query

db.query(q)

File "D:\clearn\lib\site-packages\MySQLdb\connections.py", line 259, in query

_mysql.connection.query(self, query)

MySQLdb._exceptions.ProgrammingError: (1146, "Table 'web_project.sl_models_usercollection' doesn't exist")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\shili_work\web_project\core\c_middleware.py", line 89, in process_view

response = view_func(request, *view_args, **view_kwargs)

File "D:\shili_work\web_project\apps\house\source.py", line 190, in get_house_info

collect = userCollection.objects.filter(house_id=hid, user_id=request.uid).last()

File "D:\clearn\lib\site-packages\django\db\models\query.py", line 679, in last

for obj in (self.reverse() if self.ordered else self.order_by('-pk'))[:1]:

File "D:\clearn\lib\site-packages\django\db\models\query.py", line 280, in iter

self._fetch_all()

File "D:\clearn\lib\site-packages\django\db\models\query.py", line 1324, in _fetch_all

self._result_cache = list(self._iterable_class(self))

File "D:\clearn\lib\site-packages\django\db\models\query.py", line 51, in iter

results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)

File "D:\clearn\lib\site-packages\django\db\models\sql\compiler.py", line 1175, in execute_sql

cursor.execute(sql, params)

File "D:\clearn\lib\site-packages\django\db\backends\utils.py", line 98, in execute

return super().execute(sql, params)

File "D:\clearn\lib\site-packages\django\db\backends\utils.py", line 66, in execute

return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "D:\clearn\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers

return executor(sql, params, many, context)

File "D:\clearn\lib\site-packages\django\db\backends\utils.py", line 84, in _execute

return self.cursor.execute(sql, params)

File "D:\clearn\lib\site-packages\django\db\utils.py", line 90, in exit

raise dj_exc_value.with_traceback(traceback) from exc_value

File "D:\clearn\lib\site-packages\django\db\backends\utils.py", line 84, in _execute

return self.cursor.execute(sql, params)

File "D:\clearn\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute

return self.cursor.execute(query, args)

File "D:\clearn\lib\site-packages\MySQLdb\cursors.py", line 206, in execute

res = self._query(query)

File "D:\clearn\lib\site-packages\MySQLdb\cursors.py", line 319, in _query

db.query(q)

File "D:\clearn\lib\site-packages\MySQLdb\connections.py", line 259, in query

_mysql.connection.query(self, query)

django.db.utils.ProgrammingError: (1146, "Table 'web_project.sl_models_usercollection' doesn't exist")

以上是 python-django ORM 很奇怪的问题, 的全部内容, 来源链接: utcz.com/p/938066.html

回到顶部