从 Eclipse 运行 django 服务器时没有这样的表错误
我正在使用 Django 开发一个网站。当我通过命令提示符运行服务器时,如下所示:
python manage.py runserver
它运行良好,但是当我从 Eclipse 执行此操作时(右键单击项目 -> Run As...
-> django 项目
,出现以下错误:
数据库错误位于 /
没有这样的表:django_session
请求方法:GET
请求网址: http://localhost:8000/
Django 版本:1.3
异常类型:数据库错误
异常值:
没有这样的表:django_session
关于什么会导致这种情况有什么想法吗?我不太精通 django,所以我不知道什么文件可能导致此问题 - 如果您需要我发布一些内容,请在评论中询问。
I'm developing a website using Django. When I run the server through the command prompt like so:
python manage.py runserver
it runs fine, but when I do it from Eclipse (right click on the project -> Run As...
-> django project
, I get the following error:
DatabaseError at /
no such table: django_session
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.3
Exception Type: DatabaseError
Exception Value:
no such table: django_session
Any ideas as to what can cause that? I'm not that proficient in django so I have no clue what file could be causing this - if you need me to post something, please ask here in the comments.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Eclipse/PyDev 可能无法找到数据库。假设您使用 sqlite3 数据库,请在 DATABASES 设置中使用完整路径。通过控制台进行测试,然后在 Eclipse 中进行测试。那应该有效;-)
编辑:
正如 photioionized 所建议的,最好的方法是将这些行放在 settings.py 中
,然后
SQLITE_3 现在是 sqlite3 数据库的完整路径,无论您的 django 项目位于何处。
Probably Eclipse/PyDev is not able to find the database. Assuming that you use a sqlite3 database, use a full path in the DATABASES settings. Test it via the console and afterwards within Eclipse. That should work ;-)
edit:
As photioionized suggested, the best approach is to put those lines in settings.py
and then to
SQLITE_3 is now the full path to your sqlite3 database, whereever your django project lives.
对于 Windows Eclipse,它应该是完整路径
'\\'
应该代替单斜杠。For windows eclipse, It should be full path
'\\'
should come in place of single slash.