retspen / webvirtcloud

WebVirtCloud is virtualization web interface for admins and users
1.68k stars 371 forks source link

Error when change to postgres #481

Closed anhnvme closed 2 years ago

anhnvme commented 2 years ago

Hello,

I'm tried change backend database to postgres SQL with config

DATABASES = {
    "default": {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'database',
        'USER': 'postgres',
        'PASSWORD': 'postgres',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

but while i'm access to web, i got errror

<h1 style="font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; padding: 0px; margin: 0px; font-weight: normal; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: sans-serif; background-color: rgb(255, 255, 204);">ProgrammingError at /accounts/login/</h1><pre class="exception_value" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; padding: 0px; margin: 10px 0px; font-size: 1.5em; white-space: pre-wrap; font-family: sans-serif; color: rgb(87, 87, 87); background-color: rgb(255, 255, 204);">relation "appsettings_appsettings" does not exist
LINE 1: ...es", "appsettings_appsettings"."description" FROM "appsettin...
                                                             ^
</pre>

Request Method: | GET
-- | --
http://localhost:80/accounts/login/?next=/
3.2.10
ProgrammingError
relation "appsettings_appsettings" does not exist LINE 1: ...es", "appsettings_appsettings"."description" FROM "appsettin...                                                              ^
/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/db/backends/utils.py, line 84, in _execute
/srv/webvirtcloud/venv/bin/python3
3.8.10
['/srv/webvirtcloud',  '/srv/webvirtcloud/venv/bin',  '/usr/lib/python38.zip',  '/usr/lib/python3.8',  '/usr/lib/python3.8/lib-dynload',  '/srv/webvirtcloud/venv/lib/python3.8/site-packages']

And while i'm access to postgres to show tables, it's empty. Look like database not initialized.

root@cloud-webvirtcloud-77ffc949c5-57t75:/# psql -U postgres database
psql (14.1 (Debian 14.1-1.pgdg110+1))
Type "help" for help.

database=# \dt
Did not find any relations.
database=# 

Do i miss something ?

Thanks everybody

anhnvme commented 2 years ago

Look like, need to re-run again.

python manage.py makemigrations
python manage.py migrate

Ref: https://github.com/retspen/webvirtcloud/wiki/Docker-Installation-&-Update