管理员登录停止运行Django [英] Admin login stopped functioning Django
问题描述
DoesNotExist at / admin /
站点匹配查询不存在。
请求方法:GET
请求URL:http://127.0.0.1:8000/admin/
Django版本:1.3
异常类型:DoesNotExist
异常值:
站点匹配查询不存在。
异常位置:C:\Python27\lib\site- packages\django\db\models\query.py在get,行349
$通常当我去那里时,我首先登录然后重定向我,但是现在它只是错误,除非我已经登录了 p>
我只能以admin的身份登录到我为用户创建的localhost登录功能后进入我的管理员,然后进入该页面。此外,管理页面的注销停止工作也会产生相同的错误。
我正在为用户模块添加新字段,并在发生这种情况时显示新的用户创建表单。任何人都有类似的问题?
或者也许有人知道是什么导致的?
解决方案查看这个线程,似乎是相关的。
从最后一篇文章: / p>
由于异常说站点匹配查询不存在,并且文档说了一些关于在django_site中描述站点的SITE_ID数据库表,我继续看了我的(sqlite)数据库。 django_site表是空的,所以我添加了一行id = 1(与settings.py中的一样),然后它工作。
如果你不介意丢失数据,可以尝试运行'sql appname',因为这个表应该是自动构建。
I was working on my project for a while and recently noticed that when i try to go to localhost/admin/ it gives out an error :
DoesNotExist at /admin/
Site matching query does not exist.
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.3
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.
Exception Location: C:\Python27\lib\site-packages\django\db\models\query.py in get, line 349
Usually when i go there it makes me login first and then redirects me, but now it just errors unless i am already logged in
I can only enter my admin after login in as admin in the localhost login functionality i created for users and then going to that page. Also the logout from the admin page stoped working giving the same error.
I was working on adding a new field to the user module and displaying new user creation form when this happened.
anyone had similar problem? Or maybe someone knows what causing this?
解决方案 Check out this thread, it seems relevant.
From the last post:
Since the exception said " 'Site' matching query does not exist", and the docs said something about the SITE_ID describing the site in the django_site database table, I went ahead and took a look at my (sqlite) database. The django_site table was empty, so I added a row with id==1 (the same that I have in settings.py) and then it worked.
If you don't mind loosing your data, you can try to run 'sql appname', as this table was supposed to be built automatically.
这篇关于管理员登录停止运行Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!