The X variable is not set. Defaulting to a blank string

203 Views Asked by At

I have a django secret key in a .env which is being read as a blank string part of the secret key is attached below

SECRET_KEY=|$u6qthu06zp|$q

at the point where the $ sign starts I keep getting the message

level=warning msg="The "u6qthu06zp" variable is not set. Defaulting to a blank string." level=warning msg="The "q" variable is not set. Defaulting to a blank string."

the settings file has

import os
import environ

PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)


env = environ.Env(DEBUG=(bool,False))

environ.Env.read_env(env_file=".env")

and in the final secret key is written

SECRET_KEY = env("SECRET_KEY")

however I am not being able to run the docker-compose build --remove-orphan as the SECRET_KEY is coming back as an empty string seemingly because the $ sign is causing some kind of failure. Any advice will be appreciated

The make file has

ifneq (,$(wildcard  ./ .env))
 include .env
 export
 ENV_FILE_PARAM = --env-file .env
endif

and I am trying to run

docker-compose up --build -d --remove-orphans
0

There are 0 best solutions below