Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

django - How to fix the django_sites table?

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.`

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

It seemed to indicate: manage.py syncdb

So, I wonder what to do next...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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'

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')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...