django.core.exceptions.ImproperlyConfigured: Requested setting ROOT_URLCONF, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or cal l settings.configure() before accessing settings. code example

Example: django.core.exceptions.ImproperlyConfigured: Requested setting ROOT_URLCONF, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

# It's probably easier to just use manage.py instead of django-admin
python3 manage.py <command>
# If you really want to use django-admin, you can try this
export PYTHONPATH=/home/YOUR_NAME/project_path
export DJANGO_SETTINGS_MODULE=my_project.settings
django-admin <command>