The environment variables are not being reloaded after changing env values

# settings.py
import environ
env = environ.Env(DEBUG=(bool, False),)

BASE_DIR = Path(__file__).resolve().parent.parent
environ.Env.read_env(env_file=f"{BASE_DIR}/.env")

DEFAULT_OTP = int(env("DEFAULT_OTP"))
# .env
DEFAULT_OTP=2951

Even after updating the value of DEFAULT_OTP to 2952, the Django project is still fetching the old value.

The problem has been resolved after reinstalling the virtual environment. Many thanks to all of you.

Back to Top