Fixed wrong access to settings properties

This commit is contained in:
Antoine Nguyen
2024-07-07 14:15:09 +02:00
parent 021fc1f3be
commit 005a764dc2
2 changed files with 7 additions and 7 deletions
@@ -2,7 +2,7 @@
Django settings for {{ name }} project.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
@@ -22,7 +22,7 @@ BASE_DIR = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
environ.Env.read_env(os.path.join(BASE_DIR, '.env'))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '{{ secret_key }}'
@@ -164,14 +164,14 @@ WSGI_APPLICATION = '{{ name }}.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
{% for conn in db_connections.values %}{{ conn|safe }}{% endfor %}
}
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = '{{ lang }}'
@@ -308,7 +308,7 @@ CACHES = {
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
@@ -98,14 +98,14 @@ class Command(BaseCommand):
shutil.copytree(base_frontend_dir, frontend_target_dir)
app_model = get_application_model()
allowed_host = settings.get("ALLOWED_HOSTS")
allowed_host = getattr(settings, "ALLOWED_HOSTS", None)
if allowed_host is not None:
allowed_host = allowed_host[0]
else:
allowed_host = input("What will be the hostname used to access Modoboa? ")
if not allowed_host:
allowed_host = "localhost"
frontend_path = settings.get("NEW_ADMIN_URL", "new-admin")
frontend_path = getattr(settings, "NEW_ADMIN_URL", "new-admin")
redirect_uri = f"https://{allowed_host}/{frontend_path}/login/logged"
client_id = str(uuid.uuid4())
frontend_application = app_model.objects.filter(name="frontend")