Now on writing path as sys.path.insert(0,'/home/pooja/Desktop/mysite'), it ran fine asked me for the word tobe searched and gave this error:
现在在写路径为sys.path.insert(0,'/ home / pooja / Desktop / mysite'),它运行正常问我要搜索的单词并给出了这个错误:
Traceback (most recent call last):
回溯(最近的呼叫最后):
File "call.py", line 32, in
文件“call.py”,第32行,in
s.save()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 463, in save
文件“/usr/local/lib/python2.6/dist-packages/django/db/models/base.py”,第463行,保存
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
self.save_base(using = using,force_insert = force_insert,force_update = force_update)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 524, in
文件“/usr/local/lib/python2.6/dist-packages/django/db/models/base.py”,第524行,
save_base
manager.using(using).filter(pk=pk_val).exists())):
File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 562, in exists
文件“/usr/local/lib/python2.6/dist-packages/django/db/models/query.py”,第562行,存在
return self.query.has_results(using=self.db)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 441, in has_results
在has_results中输入文件“/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py”,第441行
return bool(compiler.execute_sql(SINGLE))
File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
在execute_sql中输入文件“/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py”,第818行
cursor.execute(sql, params)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py", line 40, in execute
文件“/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py”,第40行,执行
return self.cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py", line 337, in execute return Database.Cursor.execute(self, query, params)
返回self.cursor.execute(sql,params)文件“/usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py”,第337行,执行返回Database.Cursor .execute(self,query,params)
django.db.utils.DatabaseError: no such table: search_keywords
django.db.utils.DatabaseError:没有这样的表:search_keywords
Please help!!
1 个解决方案
#1
1
The exception says: no such table: search_keywords
, which is quite self-explanatory and means that there is no database table with such name. So:
例外情况说:没有这样的表:search_keywords,这是不言自明的,意味着没有具有这种名称的数据库表。所以:
-
You may be using relative path to db file in
settings.py
, which resolves to a different db depending on place where you execute the script. Try to use absolute path and see if it helps.您可能在settings.py中使用db文件的相对路径,该路径根据执行脚本的位置解析为不同的数据库。尝试使用绝对路径,看看它是否有帮助。
-
You have not synced your models with the database. Run
manage.py syncdb
to generate the database tables.您尚未将模型与数据库同步。运行manage.py syncdb以生成数据库表。
#1
1
The exception says: no such table: search_keywords
, which is quite self-explanatory and means that there is no database table with such name. So:
例外情况说:没有这样的表:search_keywords,这是不言自明的,意味着没有具有这种名称的数据库表。所以:
-
You may be using relative path to db file in
settings.py
, which resolves to a different db depending on place where you execute the script. Try to use absolute path and see if it helps.您可能在settings.py中使用db文件的相对路径,该路径根据执行脚本的位置解析为不同的数据库。尝试使用绝对路径,看看它是否有帮助。
-
You have not synced your models with the database. Run
manage.py syncdb
to generate the database tables.您尚未将模型与数据库同步。运行manage.py syncdb以生成数据库表。