Hello there I got this error
raise ImproperlyConfigured(error_msg) from exc
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable
I have the .env file in same directory as setting.py
and here are the code in setting.py
import os
from pathlib import Path
import environ
Create an instance of the Env class
Build paths inside the project like this: BASE_DIR / ‘subdir’.
BASE_DIR = Path(file).resolve().parent.parent
Read the .env file and set the environment variables
environ.Env.read_env(BASE_DIR / ‘.env’)
env = environ.Env( # ← Updated!
# set casting, default value
DEBUG=(bool, False),
)
Quick-start development settings - unsuitable for production
See Deployment checklist | Django documentation | Django
SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env(‘SECRET_KEY’)
any help please