hotfix: use dashboard/local_settings.py instead of env vars
ci/woodpecker/pr/woodpecker Pipeline failed Details
ci/woodpecker/push/woodpecker Pipeline failed Details

My env var loading technique is not allowing local_settings.py to
override settings.py. This hotfix disables env vars in favor of
local_settings.py.

fixes https://gitea.hostea.org/Hostea/dashboard/issues/3
pull/4/head
Aravinth Manivannan 2022-06-26 01:49:32 +05:30
parent e7446dea2b
commit 3378e61606
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 38 additions and 28 deletions

View File

@ -9,11 +9,6 @@ https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import environ
import os
env = environ.Env()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
@ -31,21 +26,25 @@ ALLOWED_HOSTS = []
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
"default": env.db_url(
"DATABSE_URL", default="postgres://postgres:password@localhost:5432/postgres"
)
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "postgres",
"USER": "postgres",
"PASSWORD": "password",
"HOST": "localhost",
"PORT": "5432",
}
}
## django-payments configuration
PAYMENT_HOST = "http://localhost:8000"
PAYMENT_VARIANTS = {
"stripe": (
"payments.stripe.StripeProvider", # please don't change this
"payments.stripe.StripeProvider", # please don't change this
{
"secret_key": env.get_value("STRIPE_SECRET_KEY"),
"public_key": env.get_value("STRIPE_PUBLIC_KEY"),
"secret_key": "",
"public_key": "",
},
)
}
@ -78,6 +77,11 @@ HOSTEA = {
},
}
EMAIL_CONFIG = env.email("EMAIL_URL", default="smtp://admin:password@localhost:10025")
vars().update(EMAIL_CONFIG)
# Please see EMAIL_* configuration options:
# https://docs.djangoproject.com/en/4.1/ref/settings/#email-host
EMAIL_HOST = "localhost"
EMAIL_USE_TLS = False
EMAIL_USE_SSL = False
EMAIL_PORT = 10025
EMAIL_HOST_USER = "admin"
EMAIL_HOST_PASSWORD = "password"

View File

@ -9,13 +9,8 @@ https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import environ
import os
from pathlib import Path
env = environ.Env()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -86,9 +81,14 @@ WSGI_APPLICATION = "dashboard.wsgi.application"
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
"default": env.db_url(
"DATABSE_URL", default="postgres://postgres:password@localhost:5432/postgres"
)
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": "postgres",
"USER": "postgres",
"PASSWORD": "password",
"HOST": "localhost",
"PORT": "5432",
}
}
@ -118,7 +118,7 @@ LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
# not yet implemented so disabling as it provides performance benefits
# not yet implemented so disabling as it provides performance benefits
# ref: https://docs.djangoproject.com/en/4.0/topics/i18n/translation/
USE_I18N = False
@ -157,8 +157,8 @@ PAYMENT_VARIANTS = {
"stripe": (
"payments.stripe.StripeProvider",
{
"secret_key": env.get_value("STRIPE_SECRET_KEY", default=""),
"public_key": env.get_value("STRIPE_PUBLIC_KEY", default=""),
"secret_key": "",
"public_key": "",
},
)
}
@ -192,9 +192,15 @@ HOSTEA = {
},
}
EMAIL_CONFIG = env.email("EMAIL_URL", default="smtp://admin:password@localhost:10025")
# Please see EMAIL_* configuration options:
# https://docs.djangoproject.com/en/4.1/ref/settings/#email-host
EMAIL_HOST = "localhost"
EMAIL_USE_TLS = False
EMAIL_USE_SSL = False
EMAIL_PORT = 10025
EMAIL_HOST_USER = "admin"
EMAIL_HOST_PASSWORD = "password"
vars().update(EMAIL_CONFIG)
try:
import dashboard.local_settings