Doing a site upgrade for Django, now pushing it to the server when I try python manage.py makemigrations
I get this error
(kpsga) sammy@kpsga:~/webapps/kpsga$ python manage.py makemigrations
Traceback (most recent call last):
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
^
The above exception was the direct cause of the following exception:
...
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/sammy/webapps/kpsga/kpsga/urls.py", line 27, in <module>
path('blog', include('blog.urls')),
...
File "/home/sammy/webapps/kpsga/blog/urls.py", line 2, in <module>
from blog.views import LatestBlogEntries, blog_archive, blog_entry_by_id, blog_entry
File "/home/sammy/webapps/kpsga/blog/views.py", line 10, in <module>
class LatestBlogEntries(Feed):
File "/home/sammy/webapps/kpsga/blog/views.py", line 11, in LatestBlogEntries
current_site = Site.objects.get_current()
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/contrib/sites/models.py", line 58, in get_current
return self._get_site_by_id(site_id)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/contrib/sites/models.py", line 30, in _get_site_by_id
site = self.get(pk=site_id)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/models/query.py", line 425, in get
num = len(clone)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/models/query.py", line 269, in __len__
self._fetch_all()
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/models/query.py", line 1308, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql
cursor.execute(sql, params)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/sammy/webapps/envs/kpsga/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "django_site" does not exist
LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
though I've got these added to the settings file
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#additional django
'django.contrib.sites',
]
SITE_ID = 1
LatestClass
class LatestBlogEntries(Feed):
current_site = Site.objects.get_current()
title = current_site.name + " - Latest News"
link = "/news/"
description = "Latest news and updates from " + current_site.domain
def items(self):
return BlogEntry.objects.all()[:10]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.description
See Question&Answers more detail:
os