[GH-ISSUE #648] Update error #374

Closed
opened 2026-02-27 15:58:26 +03:00 by kerem · 5 comments
Owner

Originally created by @CryptoCopter on GitHub (Jun 17, 2024).
Original GitHub issue: https://github.com/retspen/webvirtcloud/issues/648

I tried following the "How To Update" setion of the readme.
I ran all commands in the order specified, but when trying to run the migration (5th step) I get the following error:

(venv) msommer@deimos:/srv/webvirtcloud$ python3 manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/srv/webvirtcloud/accounts/models.py", line 5, in <module>
    from instances.models import Instance
  File "/srv/webvirtcloud/instances/models.py", line 7, in <module>
    from webvirtcloud.settings import QEMU_CONSOLE_LISTENER_ADDRESSES
ImportError: cannot import name 'QEMU_CONSOLE_LISTENER_ADDRESSES' from 'webvirtcloud.settings' (/srv/webvirtcloud/webvirtcloud/settings.py)
Originally created by @CryptoCopter on GitHub (Jun 17, 2024). Original GitHub issue: https://github.com/retspen/webvirtcloud/issues/648 I tried following the "How To Update" setion of the readme. I ran all commands in the order specified, but when trying to run the migration (5th step) I get the following error: ``` (venv) msommer@deimos:/srv/webvirtcloud$ python3 manage.py migrate Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 416, in execute django.setup() File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate app_config.import_models() File "/srv/webvirtcloud/venv/lib/python3.8/site-packages/django/apps/config.py", line 269, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 848, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/srv/webvirtcloud/accounts/models.py", line 5, in <module> from instances.models import Instance File "/srv/webvirtcloud/instances/models.py", line 7, in <module> from webvirtcloud.settings import QEMU_CONSOLE_LISTENER_ADDRESSES ImportError: cannot import name 'QEMU_CONSOLE_LISTENER_ADDRESSES' from 'webvirtcloud.settings' (/srv/webvirtcloud/webvirtcloud/settings.py) ```
kerem closed this issue 2026-02-27 15:58:26 +03:00
Author
Owner

@catborise commented on GitHub (Jun 17, 2024):

Can you please checkout settings.py.template file for difference according to settings.py file.

Does your settings.py file contains the specified variable.


QEMU_CONSOLE_LISTENER_ADDRESSES = (
    ("127.0.0.1", _("Localhost")),
    ("0.0.0.0", _("All interfaces")),
)
<!-- gh-comment-id:2174452950 --> @catborise commented on GitHub (Jun 17, 2024): Can you please checkout settings.py.template file for difference according to settings.py file. Does your settings.py file contains the specified variable. ``` QEMU_CONSOLE_LISTENER_ADDRESSES = ( ("127.0.0.1", _("Localhost")), ("0.0.0.0", _("All interfaces")), ) ```
Author
Owner

@CryptoCopter commented on GitHub (Jun 18, 2024):

ah, I assume the name has changed, and my settings.pystill has the old name?

contents of settings.py:

msommer@deimos:/srv/webvirtcloud$ cat webvirtcloud/settings.py
"""
Django settings for webvirtcloud project.

"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

SECRET_KEY = <expunged>

DEBUG = False

ALLOWED_HOSTS = ["*"]

# Application definition
INSTALLED_APPS = [
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "bootstrap4",
    "django_icons",
    "django_otp",
    "django_otp.plugins.otp_totp",
    "accounts",
    "admin",
    "appsettings",
    "computes",
    "console",
    "datasource",
    "networks",
    "instances",
    "interfaces",
    "nwfilters",
    "storages",
    "secrets",
    "logs",
    "qr_code",
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.locale.LocaleMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django_otp.middleware.OTPMiddleware",
    "login_required.middleware.LoginRequiredMiddleware",
    "django.contrib.auth.middleware.RemoteUserMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
    "appsettings.middleware.AppSettingsMiddleware",
    "webvirtcloud.middleware.ExceptionMiddleware",
]

ROOT_URLCONF = "webvirtcloud.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [
            os.path.join(BASE_DIR, "templates"),
        ],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "appsettings.context_processors.app_settings",
            ],
            "libraries": {
                "common_tags": "webvirtcloud.common_tags",
            },
        },
    },
]

WSGI_APPLICATION = "webvirtcloud.wsgi.application"

# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": os.path.join(BASE_DIR, "db.sqlite3"),
    }
}

AUTHENTICATION_BACKENDS = [
    "django.contrib.auth.backends.ModelBackend",
]

LOGIN_URL = "/accounts/login/"

LOGOUT_REDIRECT_URL = "/accounts/login/"

LANGUAGE_CODE = "en-us"

TIME_ZONE = 'Europe/Berlin'

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = "/static/"

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]

LOCALE_PATHS = [
    "locale/",
]

LOGGING = {
    "version": 1,
    "disable_existing_loggers": False,
    "handlers": {
        "mail_admins": {"level": "ERROR", "class": "django.utils.log.AdminEmailHandler"}
    },
    "loggers": {
        "django.request": {
            "handlers": ["mail_admins"],
            "level": "ERROR",
            "propagate": True,
        }
    },
}

#
# WebVirtCloud settings
#

# Websock port
WS_PORT = 6080

# Websock host
WS_HOST = '0.0.0.0'

# Websock public port - 80 or 443 if reverse-proxy, else 6080
WS_PUBLIC_PORT = 6080

# Websock public host
WS_PUBLIC_HOST = None

# Websock public path
WS_PUBLIC_PATH = "/novncd/"

# Websock Certificate for SSL
WS_CERT = None

# List of console listen addresses
QEMU_CONSOLE_LISTEN_ADDRESSES = (
    ("127.0.0.1", "Localhost"),
    ("0.0.0.0", "All interfaces"),
)

# List taken from http://qemu.weilnetz.de/qemu-doc.html#sec_005finvocation
QEMU_KEYMAPS = [
    "ar",
    "da",
    "de",
    "de-ch",
    "en-gb",
    "en-us",
    "es",
    "et",
    "fi",
    "fo",
    "fr",
    "fr-be",
    "fr-ca",
    "fr-ch",
    "hr",
    "hu",
    "is",
    "it",
    "ja",
    "lt",
    "lv",
    "mk",
    "nl",
    "nl-be",
    "no",
    "pl",
    "pt",
    "pt-br",
    "ru",
    "sl",
    "sv",
    "th",
    "tr",
]

# Keepalive interval and count for libvirt connections
LIBVIRT_KEEPALIVE_INTERVAL = 5
LIBVIRT_KEEPALIVE_COUNT = 5

ALLOW_EMPTY_PASSWORD = False
NEW_USER_DEFAULT_INSTANCES = []
SHOW_PROFILE_EDIT_PASSWORD = True

OTP_ENABLED = False

LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:email_otp"]

contents of settings.py.template:

msommer@deimos:/srv/webvirtcloud$ cat webvirtcloud/settings.py.template
"""
Django settings for webvirtcloud project.

"""

import ldap
import subprocess
from django_auth_ldap.config import LDAPSearch, NestedActiveDirectoryGroupType
from django.utils.translation import gettext_lazy as _
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = ""

DEBUG = False

MAC_OUI = '52:54:10'

ALLOWED_HOSTS = ["*"]

CSRF_TRUSTED_ORIGINS = ['http://localhost',]

# Application definition
INSTALLED_APPS = [
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django_bootstrap5",
    "django_bootstrap_icons",
    "django_otp",
    "django_otp.plugins.otp_totp",
    "drf_yasg",
    "accounts",
    "admin",
    "appsettings",
    "computes",
    "console",
    "datasource",
    "networks",
    "instances",
    "interfaces",
    "nwfilters",
    "storages",
    "virtsecrets",
    "logs",
    "qr_code",
    "rest_framework",
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "whitenoise.middleware.WhiteNoiseMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.locale.LocaleMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django_otp.middleware.OTPMiddleware",
    "login_required.middleware.LoginRequiredMiddleware",
    "django.contrib.auth.middleware.RemoteUserMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
    "appsettings.middleware.AppSettingsMiddleware",
    "webvirtcloud.middleware.ExceptionMiddleware",
]

ROOT_URLCONF = "webvirtcloud.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [
            Path.joinpath(BASE_DIR, "templates"),
        ],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "appsettings.context_processors.app_settings",
            ],
            "libraries": {
                "common_tags": "webvirtcloud.common_tags",
            },
        },
    },
]

WSGI_APPLICATION = "webvirtcloud.wsgi.application"


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": Path.joinpath(BASE_DIR, "db.sqlite3"),
    }
}

AUTHENTICATION_BACKENDS = [
    "django.contrib.auth.backends.ModelBackend",
    #"django_auth_ldap.backend.LDAPBackend",
]

LOGIN_URL = "/accounts/login/"

LOGOUT_REDIRECT_URL = "/accounts/login/"

LOGIN_REDIRECT_URL="/instances/"

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = "/static/"

STATIC_ROOT = Path.joinpath(BASE_DIR, "static")


BS_ICONS_CACHE = Path.joinpath(BASE_DIR, 'static/icon_cache')

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


LOCALE_PATHS = [
    "locale/",
]

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'standard': {
            'format': '[%(asctime)s] %(levelname)s: %(message)s'
        },
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
            },
        'default': {
            'level':'INFO',
            'class':'logging.handlers.RotatingFileHandler',
            'filename': 'webvirtcloud.log',
            'formatter':'standard',
        },
    },
    'loggers': {
        '': {
            'handlers': ['default'],
            'level': 'INFO',
            'propagate': True
        },
        'django.request': {
            "handlers": ["mail_admins"],
            "level": "ERROR",
            "propagate": True,
        }
    },
}


#
# WebVirtCloud settings
#

# Websock port
WS_PORT = 6080

# Websock host
WS_HOST = "0.0.0.0"

# Websock public port - 80 or 443 if reverse-proxy, else 6080
WS_PUBLIC_PORT = 6080

# Websock public host
WS_PUBLIC_HOST = None

# Websock public path
WS_PUBLIC_PATH = "/novncd/"

# Websock Certificate for SSL
WS_CERT = None

SOCKETIO_PORT = 6081
SOCKETIO_HOST = "0.0.0.0"

# Socketio public host
SOCKETIO_PUBLIC_HOST = None

# Socketio public port - 80 or 443 if reverse-proxy, else 6081
SOCKETIO_PUBLIC_PORT = 6081

# Socketio public path
SOCKETIO_PUBLIC_PATH = "socket.io/"

# List of console listen addresses
QEMU_CONSOLE_LISTENER_ADDRESSES = (
    ("127.0.0.1", _("Localhost")),
    ("0.0.0.0", _("All interfaces")),
)

# List taken from http://qemu.weilnetz.de/qemu-doc.html#sec_005finvocation
QEMU_KEYMAPS = [
    "ar",
    "da",
    "de",
    "de-ch",
    "en-gb",
    "en-us",
    "es",
    "et",
    "fi",
    "fo",
    "fr",
    "fr-be",
    "fr-ca",
    "fr-ch",
    "hr",
    "hu",
    "is",
    "it",
    "ja",
    "lt",
    "lv",
    "mk",
    "nl",
    "nl-be",
    "no",
    "pl",
    "pt",
    "pt-br",
    "ru",
    "sl",
    "sv",
    "th",
    "tr",
]

# Keepalive interval and count for libvirt connections
LIBVIRT_KEEPALIVE_INTERVAL = 5
LIBVIRT_KEEPALIVE_COUNT = 5

ALLOW_EMPTY_PASSWORD = False
NEW_USER_DEFAULT_INSTANCES = []
SHOW_PROFILE_EDIT_PASSWORD = True


# OTP Config
OTP_ENABLED = False

LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:login", "accounts:email_otp"]

# EMAIL Config
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
## sender's email-id
EMAIL_HOST_USER = ''
## password associated with above email-id
EMAIL_HOST_PASSWORD = ''

# LDAP Config
#

AUTH_LDAP_SERVER_URI = "ldap://example.com"
AUTH_LDAP_BIND_DN = "username@example.com"
AUTH_LDAP_BIND_PASSWORD = "password"
AUTH_LDAP_USER_SEARCH = LDAPSearch(
    "CN=Users,DC=example,DC=com", ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)"
)
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
    "CN=Users,DC=example,DC=com", ldap.SCOPE_SUBTREE, "(objectClass=group)"
)
AUTH_LDAP_GROUP_TYPE = NestedActiveDirectoryGroupType()
AUTH_LDAP_REQUIRE_GROUP = "CN=WebVirtCloud Access,CN=Users,DC=example,DC=com"
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
    "is_staff": "CN=WebVirtCloud Staff,CN=Users,DC=example,DC=com",
    "is_superuser": "CN=WebVirtCloud Admins,CN=Users,DC=example,DC=com",
}
AUTH_LDAP_USER_ATTR_MAP = {
    "first_name": "givenName",
    "last_name": "sn",
    "email": "mail",
}
<!-- gh-comment-id:2175591375 --> @CryptoCopter commented on GitHub (Jun 18, 2024): ah, I assume the name has changed, and my `settings.py`still has the old name? contents of `settings.py`: ``` msommer@deimos:/srv/webvirtcloud$ cat webvirtcloud/settings.py """ Django settings for webvirtcloud project. """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = <expunged> DEBUG = False ALLOWED_HOSTS = ["*"] # Application definition INSTALLED_APPS = [ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "bootstrap4", "django_icons", "django_otp", "django_otp.plugins.otp_totp", "accounts", "admin", "appsettings", "computes", "console", "datasource", "networks", "instances", "interfaces", "nwfilters", "storages", "secrets", "logs", "qr_code", ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django_otp.middleware.OTPMiddleware", "login_required.middleware.LoginRequiredMiddleware", "django.contrib.auth.middleware.RemoteUserMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "appsettings.middleware.AppSettingsMiddleware", "webvirtcloud.middleware.ExceptionMiddleware", ] ROOT_URLCONF = "webvirtcloud.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [ os.path.join(BASE_DIR, "templates"), ], "APP_DIRS": True, "OPTIONS": { "context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", "appsettings.context_processors.app_settings", ], "libraries": { "common_tags": "webvirtcloud.common_tags", }, }, }, ] WSGI_APPLICATION = "webvirtcloud.wsgi.application" # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": os.path.join(BASE_DIR, "db.sqlite3"), } } AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", ] LOGIN_URL = "/accounts/login/" LOGOUT_REDIRECT_URL = "/accounts/login/" LANGUAGE_CODE = "en-us" TIME_ZONE = 'Europe/Berlin' USE_I18N = True USE_L10N = True USE_TZ = True STATIC_URL = "/static/" STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] LOCALE_PATHS = [ "locale/", ] LOGGING = { "version": 1, "disable_existing_loggers": False, "handlers": { "mail_admins": {"level": "ERROR", "class": "django.utils.log.AdminEmailHandler"} }, "loggers": { "django.request": { "handlers": ["mail_admins"], "level": "ERROR", "propagate": True, } }, } # # WebVirtCloud settings # # Websock port WS_PORT = 6080 # Websock host WS_HOST = '0.0.0.0' # Websock public port - 80 or 443 if reverse-proxy, else 6080 WS_PUBLIC_PORT = 6080 # Websock public host WS_PUBLIC_HOST = None # Websock public path WS_PUBLIC_PATH = "/novncd/" # Websock Certificate for SSL WS_CERT = None # List of console listen addresses QEMU_CONSOLE_LISTEN_ADDRESSES = ( ("127.0.0.1", "Localhost"), ("0.0.0.0", "All interfaces"), ) # List taken from http://qemu.weilnetz.de/qemu-doc.html#sec_005finvocation QEMU_KEYMAPS = [ "ar", "da", "de", "de-ch", "en-gb", "en-us", "es", "et", "fi", "fo", "fr", "fr-be", "fr-ca", "fr-ch", "hr", "hu", "is", "it", "ja", "lt", "lv", "mk", "nl", "nl-be", "no", "pl", "pt", "pt-br", "ru", "sl", "sv", "th", "tr", ] # Keepalive interval and count for libvirt connections LIBVIRT_KEEPALIVE_INTERVAL = 5 LIBVIRT_KEEPALIVE_COUNT = 5 ALLOW_EMPTY_PASSWORD = False NEW_USER_DEFAULT_INSTANCES = [] SHOW_PROFILE_EDIT_PASSWORD = True OTP_ENABLED = False LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:email_otp"] ``` contents of `settings.py.template`: ``` msommer@deimos:/srv/webvirtcloud$ cat webvirtcloud/settings.py.template """ Django settings for webvirtcloud project. """ import ldap import subprocess from django_auth_ldap.config import LDAPSearch, NestedActiveDirectoryGroupType from django.utils.translation import gettext_lazy as _ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = "" DEBUG = False MAC_OUI = '52:54:10' ALLOWED_HOSTS = ["*"] CSRF_TRUSTED_ORIGINS = ['http://localhost',] # Application definition INSTALLED_APPS = [ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "django_bootstrap5", "django_bootstrap_icons", "django_otp", "django_otp.plugins.otp_totp", "drf_yasg", "accounts", "admin", "appsettings", "computes", "console", "datasource", "networks", "instances", "interfaces", "nwfilters", "storages", "virtsecrets", "logs", "qr_code", "rest_framework", ] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django_otp.middleware.OTPMiddleware", "login_required.middleware.LoginRequiredMiddleware", "django.contrib.auth.middleware.RemoteUserMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "appsettings.middleware.AppSettingsMiddleware", "webvirtcloud.middleware.ExceptionMiddleware", ] ROOT_URLCONF = "webvirtcloud.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [ Path.joinpath(BASE_DIR, "templates"), ], "APP_DIRS": True, "OPTIONS": { "context_processors": [ "django.template.context_processors.debug", "django.template.context_processors.request", "django.contrib.auth.context_processors.auth", "django.contrib.messages.context_processors.messages", "appsettings.context_processors.app_settings", ], "libraries": { "common_tags": "webvirtcloud.common_tags", }, }, }, ] WSGI_APPLICATION = "webvirtcloud.wsgi.application" # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": Path.joinpath(BASE_DIR, "db.sqlite3"), } } AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", #"django_auth_ldap.backend.LDAPBackend", ] LOGIN_URL = "/accounts/login/" LOGOUT_REDIRECT_URL = "/accounts/login/" LOGIN_REDIRECT_URL="/instances/" LANGUAGE_CODE = "en-us" TIME_ZONE = "UTC" USE_I18N = True USE_L10N = True USE_TZ = True STATIC_URL = "/static/" STATIC_ROOT = Path.joinpath(BASE_DIR, "static") BS_ICONS_CACHE = Path.joinpath(BASE_DIR, 'static/icon_cache') # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' LOCALE_PATHS = [ "locale/", ] LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': '[%(asctime)s] %(levelname)s: %(message)s' }, }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler' }, 'default': { 'level':'INFO', 'class':'logging.handlers.RotatingFileHandler', 'filename': 'webvirtcloud.log', 'formatter':'standard', }, }, 'loggers': { '': { 'handlers': ['default'], 'level': 'INFO', 'propagate': True }, 'django.request': { "handlers": ["mail_admins"], "level": "ERROR", "propagate": True, } }, } # # WebVirtCloud settings # # Websock port WS_PORT = 6080 # Websock host WS_HOST = "0.0.0.0" # Websock public port - 80 or 443 if reverse-proxy, else 6080 WS_PUBLIC_PORT = 6080 # Websock public host WS_PUBLIC_HOST = None # Websock public path WS_PUBLIC_PATH = "/novncd/" # Websock Certificate for SSL WS_CERT = None SOCKETIO_PORT = 6081 SOCKETIO_HOST = "0.0.0.0" # Socketio public host SOCKETIO_PUBLIC_HOST = None # Socketio public port - 80 or 443 if reverse-proxy, else 6081 SOCKETIO_PUBLIC_PORT = 6081 # Socketio public path SOCKETIO_PUBLIC_PATH = "socket.io/" # List of console listen addresses QEMU_CONSOLE_LISTENER_ADDRESSES = ( ("127.0.0.1", _("Localhost")), ("0.0.0.0", _("All interfaces")), ) # List taken from http://qemu.weilnetz.de/qemu-doc.html#sec_005finvocation QEMU_KEYMAPS = [ "ar", "da", "de", "de-ch", "en-gb", "en-us", "es", "et", "fi", "fo", "fr", "fr-be", "fr-ca", "fr-ch", "hr", "hu", "is", "it", "ja", "lt", "lv", "mk", "nl", "nl-be", "no", "pl", "pt", "pt-br", "ru", "sl", "sv", "th", "tr", ] # Keepalive interval and count for libvirt connections LIBVIRT_KEEPALIVE_INTERVAL = 5 LIBVIRT_KEEPALIVE_COUNT = 5 ALLOW_EMPTY_PASSWORD = False NEW_USER_DEFAULT_INSTANCES = [] SHOW_PROFILE_EDIT_PASSWORD = True # OTP Config OTP_ENABLED = False LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ["accounts:login", "accounts:email_otp"] # EMAIL Config EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_USE_TLS = True EMAIL_PORT = 587 ## sender's email-id EMAIL_HOST_USER = '' ## password associated with above email-id EMAIL_HOST_PASSWORD = '' # LDAP Config # AUTH_LDAP_SERVER_URI = "ldap://example.com" AUTH_LDAP_BIND_DN = "username@example.com" AUTH_LDAP_BIND_PASSWORD = "password" AUTH_LDAP_USER_SEARCH = LDAPSearch( "CN=Users,DC=example,DC=com", ldap.SCOPE_SUBTREE, "(sAMAccountName=%(user)s)" ) AUTH_LDAP_GROUP_SEARCH = LDAPSearch( "CN=Users,DC=example,DC=com", ldap.SCOPE_SUBTREE, "(objectClass=group)" ) AUTH_LDAP_GROUP_TYPE = NestedActiveDirectoryGroupType() AUTH_LDAP_REQUIRE_GROUP = "CN=WebVirtCloud Access,CN=Users,DC=example,DC=com" AUTH_LDAP_USER_FLAGS_BY_GROUP = { "is_staff": "CN=WebVirtCloud Staff,CN=Users,DC=example,DC=com", "is_superuser": "CN=WebVirtCloud Admins,CN=Users,DC=example,DC=com", } AUTH_LDAP_USER_ATTR_MAP = { "first_name": "givenName", "last_name": "sn", "email": "mail", } ```
Author
Owner

@CryptoCopter commented on GitHub (Jun 18, 2024):

so I have QEMU_CONSOLE_LISTEN_ADDRESSES where it should be QEMU_CONSOLE_LISTENER_ADDRESSES do I just change it by hand, or is there a better way?

<!-- gh-comment-id:2176347030 --> @CryptoCopter commented on GitHub (Jun 18, 2024): so I have `QEMU_CONSOLE_LISTEN_ADDRESSES` where it should be `QEMU_CONSOLE_LISTENER_ADDRESSES` do I just change it by hand, or is there a better way?
Author
Owner

@catborise commented on GitHub (Jun 18, 2024):

You must change it with hand in settings.py file. It is standart way… settings.py file is static and bootstrap file.

<!-- gh-comment-id:2176514670 --> @catborise commented on GitHub (Jun 18, 2024): You must change it with hand in settings.py file. It is standart way… settings.py file is static and bootstrap file.
Author
Owner

@CryptoCopter commented on GitHub (Jun 19, 2024):

thanks!

<!-- gh-comment-id:2178209275 --> @CryptoCopter commented on GitHub (Jun 19, 2024): thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtcloud#374
No description provided.