DAMAR225
DAMAR225

Reputation: 2447

no such table: wagtailcore_site

I'm hosting two websites on ubuntu server and both having postgresql, the first one is working prefect but the second give me this error

no such table: wagtailcore_site Request Method: GET

Django Version: 2.2.10 Exception

Type: OperationalError Exception Value: no such table:

wagtailcore_site Exception

Location: /home/project2/.venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py

in execute, line 383 Python

Executable: /home/project2/.venv/bin/python3.7m Python Version: 3.7.3

database settings for first website:

    DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'project_one',
        'USER': 'project_one',
        'PASSWORD': '123',
        'HOST': '127.0.0.1',
        'PORT': '',
    }
}

database settings for second website:

    DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'project_two',
        'USER': 'project_two',
        'PASSWORD': '123',
        'HOST': '127.0.0.1',
        'PORT': '',
    }
}

from the error it seems that django try to run sqllite instead of postgresql, I dont know why !

Notes:

I think the problem maybe with the HOST and PORT settings in both settings maybe they conflicting each other? ( I try change the port and host also but didn't solve it)

thanks.

Upvotes: 2

Views: 2062

Answers (2)

Kyrony
Kyrony

Reputation: 609

Django 3.2 will also call this exception while integrating wagtail. If you haven't made migrations before adding the core url, youll get this error.

django.db.utils.OperationalError: no such table: wagtailcore_site

If you just make migrations it should fix this issue

Upvotes: 1

DAMAR225
DAMAR225

Reputation: 2447

My bad, I have two gunicorn files for both websites and I was restarting gunicorn for first websites not the second one.

Which mean there is no errors in the code above.. The problem only in restarting gunicorn.

Upvotes: 0

Related Questions