Django exception when trying to delete course

I am running the Juniper release of OpenEDX. I was trying to delete courses.
I found a few commands that should help, such as:

 sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings production

But this just throws this error:

django.core.exceptions.ImproperlyConfigured: Set the LMS_CFG env variable

I also tried to change the course start date and also change course visibility in advanced settings in Studio, which didn’t seem to work. Any help would be appreciated.

su -l edxapp -s /bin/bash
source edxapp_env
cd edx-platform/
/edx/bin/python.edxapp ./manage.py lms dump_course_ids --settings production
/edx/bin/python.edxapp ./manage.py cms --settings=production delete_course

Thanks for the help.
The last command throws this error
django.core.exceptions.ImproperlyConfigured: Set the STUDIO_CFG env variable

umm, Maybe your environment variables file is incomplete, since when you execute the “source edxapp_env” command it loads that variable that sends you an error