Robin
Robin

Reputation: 5486

No such table as django_site

I am following from the docs of django-disqus to use it in my project. I have installed it in my settings, with other needed settings (API key and short name). But when I try to run these commands:

>>> from django.contrib.sites.models import Site
>>> Site.objects.all()

I am getting an error:

OperationalError: no such table: django_site

I have already installed django.contrib.admin in my settings and is using it in my project. So what am I missing?

Upvotes: 8

Views: 15561

Answers (3)

Ehvince
Ehvince

Reputation: 18415

Had this issue because I had an exit(1) (error code) in a migration of mine. All migrations were not run, that was the hint.

Upvotes: 0

Tanon
Tanon

Reputation: 1

For me it is working only if I do the migration before starting using the Site app. I have to remove all the imports in the code then makemigration/migrate. After that I start using the Site app.

Upvotes: 0

Alasdair
Alasdair

Reputation: 309099

Make sure you have added 'django.contrib.sites' to your INSTALLED_APPS, then run migrate to create the required table.

python manage.py migrate

Upvotes: 26

Related Questions