In my Django settings I have:
in env.py:
os.environ.setdefault(
"DEBUG", "True"
)
in settings.py:
DEBUG = os.environ.get('DEBUG') == 'True'
However some of the systems are not visible after deploying but they are perfect on my local server.
I tried changing the DEBUG value to false but nothing changes.
In my Django settings I have:
in env.py:
os.environ.setdefault(
"DEBUG", "True"
)
in settings.py:
DEBUG = os.environ.get('DEBUG') == 'True'
However some of the systems are not visible after deploying but they are perfect on my local server.
I tried changing the DEBUG value to false but nothing changes.
As per django-environ docs
try something like this
.env
DEBUG=on
DB_NAME=LOCAL_DB_NAME
settings.py
import environ
# cast default value
env = environ.Env(
DEBUG=(bool, False),
MAIL_ENABLED=(bool, False)
)
# False if not in os.environ because of casting above
DEBUG = env('DEBUG') # True
It seems that you are not executing env.py file before settings.py.
In local server, you might have executed env.py file manually and it was recorded in OS. So, even though settings.py didn't execute the env.py file, it worked as intended.
In production or remote server Make sure you are importing (or in some other way executing) env.py before settings.py.
settings.py
import os
import env # your env.py file
DEBUG = os.environ.get('DEBUG') == 'True'
...
As the top comment mentions env.py is not the standard/common way of using environment variables, especially in production.
During development using .env file is very common, and in production, setting environment variables using cloud provider's services as such AWS Secrets Managers etc is the common/recommended way.

env.py? That doesn't look like a standard Django module. How are you using it? – John Gordon Commented Jan 31 at 21:58