Modified SECRET_KEY for Jenkins

This commit is contained in:
JKuijperM 2026-01-16 23:53:34 +01:00
parent 158376aa61
commit 96f58127b2
2 changed files with 5 additions and 3 deletions

View File

@ -2,6 +2,7 @@ pipeline{
agent any agent any
environment { environment {
DJANGO_SECRET_KEY = 'test-secret-key-for-ci'
DJANGO_SETTINGS_MODULE = "expenses_manager.settings" DJANGO_SETTINGS_MODULE = "expenses_manager.settings"
PYTHONUNBUFFERED = "1" PYTHONUNBUFFERED = "1"
} }
@ -29,9 +30,10 @@ pipeline{
stage('Run tests') { stage('Run tests') {
steps { steps {
sh ''' sh '''
. venv/bin/activate
cd expenses_manager cd expenses_manager
ls
. venv/bin/activate
export SECRET_KEY=$DJANGO_SECRET_KEY
venv/bin/pytest --cov venv/bin/pytest --cov
''' '''
} }

View File

@ -29,7 +29,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv("DEBUG") == "True" DEBUG = os.getenv("DEBUG") == "True"
SECRET_KEY = os.getenv("SECRET_KEY") SECRET_KEY = os.environ.get('SECRET_KEY', 'fallback-secret-key-for-dev')
ALLOWED_HOSTS = [] ALLOWED_HOSTS = []