user3882939
user3882939

Reputation: 13

OperationalError at : "site" Exception Value: No such Table django_site

I thought i had uploaded my project correctly to a remote server/host at asmallorange, but I keep running into problems.

This is what i did: Followed all the instructions on this page: https://help.asmallorange.com/index.php?/Knowledgebase/Article/View/305/0/install-django-using-virtualenv

checked my website (angusrchen.com) and got a default "welcome to django!" page. Okay, so i know that django is installed correctly.

then i used filezilla to upload my project files to the directory path where I had created the project on the remote server.

I ran $ python manage.py syncdb

no errors, then

$ python manage.py collectstatic

no errors.

Two problems: Base.html is loading when i go to my webpage, but none of the javascript seems to be working.

and now i'm getting this error when i try to navigate to any of the django pages (like /admin or /blog)

error is below:

OperationalError at /blog/
no such table: django_site
Request Method: GET
Request URL:    http://angusrchen.com/blog/
Django Version: 1.6.5
Exception Type: OperationalError
Exception Value:    no such table: django_site
Exception Location: /home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 451
Python Executable:  /home/angusrch/.env/env/bin/python
Python Version: 2.7.6
Python Path:    ['/home/angusrch/.env/env/lib/python2.7/site-packages',
'/home/angusrch/public_html',
'/home/angusrch/.env/env/lib/python27.zip',
'/home/angusrch/.env/env/lib/python2.7',
'/home/angusrch/.env/env/lib/python2.7/plat-linux2',
'/home/angusrch/.env/env/lib/python2.7/lib-tk',
'/home/angusrch/.env/env/lib/python2.7/lib-old',
'/home/angusrch/.env/env/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk']
Server time:    Sat, 2 Aug 2014 11:18:06 -0500



Environment:


Request Method: GET
Request URL: http://angusrchen.com/blog/

Django Version: 1.6.5
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.comments',
 'django.contrib.sites',
 'tagging',
 'mptt',
 'blog',
 'zinnia')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/dates.py" in get
  333.         self.date_list, self.object_list, extra_context = self.get_dated_items()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/dates.py" in get_dated_items
  414.         qs = self.get_dated_queryset(ordering='-%s' % self.get_date_field())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/views/generic/dates.py" in get_dated_queryset
  350.         qs = self.get_queryset().filter(**lookup)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/views/mixins/prefetch_related.py" in get_queryset
  25.         return super(PrefetchRelatedMixin, self
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/views/mixins/callable_queryset.py" in get_queryset
  20.         return self.queryset()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/manager.py" in all
  133.         return self.get_queryset()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/managers.py" in get_queryset
  46.             super(EntryPublishedManager, self).get_queryset())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/zinnia/managers.py" in entries_published
  33.         status=PUBLISHED, sites=Site.objects.get_current())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/contrib/sites/models.py" in get_current
  47.             current_site = self.get(pk=sid)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/manager.py" in get
  151.         return self.get_queryset().get(*args, **kwargs)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in get
  304.         num = len(clone)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in __len__
  77.         self._fetch_all()
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  857.             self._result_cache = list(self.iterator())
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  220.         for row in compiler.results_iter():
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  713.         for rows in self.execute_sql(MULTI):
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  786.         cursor.execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/angusrch/.env/env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
  451.         return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /blog/
Exception Value: no such table: django_site

Upvotes: 0

Views: 3853

Answers (1)

Raphael Laurent
Raphael Laurent

Reputation: 1951

Your error simply state that your database does not contain the table django_site.

Try inspecting the database (see if the table is indeed present), check you're accessing the good one in your settings (if you have multiple databases on your server).

Also make sure everything works in development environment, if so you can either copy the database from your development environment to your server, or delete the one on the server and run syncdb again.

PS : I think you would get another error if you couldn't access the database, but check your file permissions, maybe it can cause this as well.

Upvotes: 2

Related Questions