如何修复django_sites表? [英] How to fix the django_sites table?

查看:86
本文介绍了如何修复django_sites表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图获得一个 oauth 模块,我做了以下工作: manage.py reset sites

Trying to get an oauth module to work I made the pro-move of : manage.py reset sites

这样会影响我的网站的管理员和登录功能。

This had the effect killing the admin and login functionality of my site.

所以,我的问题是我可以回到正方形并修复我所打破的东西。

So, my question is how to I get back to square one and fix what I broke.

尝试显示管理工具时,我当前的错误是:

Here is my current error when trying to display the admin tool:

DoesNotExist at /admin/
Site matching query does not exist.
Request Method: GET
Request URL:    http://mdev.5buckchuck.com/admin/
Django Version: 1.3
Exception Type: DoesNotExist
Exception Value:    
Site matching query does not exist.`

我查看了文档,但我失去了并厌倦了:
http://docs.djangoproject.com /en/1.3/ref/contrib/sites/

I looked at the documentation but I am lost and tired in it: http://docs.djangoproject.com/en/1.3/ref/contrib/sites/

似乎表明: manage.py syncdb

所以,我不知道下一步该怎么做...

So, I wonder what to do next...

推荐答案

如果您只从项目中运行一个网站,您不需要网站框架,因此最简单的修复将是从您的 INSTALLED_APPS ,错误应该消失:

You don't really need the sites framework if you only run one site from the project, so the easiest fix would be to remove the following item from your INSTALLED_APPS and the error should go away:

'django.contrib.sites'

您还可以重新创建缺少的网站对象地狱。运行 python manage.py shell 然后:

You can also re-create the missing Site object from shell. Run python manage.py shell and then:

from django.contrib.sites.models import Site
Site.objects.create(pk=1, domain='mdev.5buckchuck.com', name='5buckchuck.com')

这篇关于如何修复django_sites表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆