How can we delete the created course?

4,754 views
Skip to first unread message

praveen pal

unread,
Jun 28, 2013, 1:56:37 AM6/28/13
to edx-...@googlegroups.com
Hello
     I have created few courses  in edx-studio  for testing purpose,
     now i want to completely delete those courses, but i don't find any way to delete those course.
     anybody can help me to delete those course.
  

Thank you  


Jay Zoldak

unread,
Jun 28, 2013, 8:50:26 AM6/28/13
to praveen pal, edx-code
Praveen --

I put these instructions on the Troubleshooting page of the wiki: https://github.com/edx/edx-platform/wiki/Troubleshooting
You can do this directly in mongo. From a terminal session, access the mongo shell with `mongo`

Then use the commands below:

To list all the courses:

use xmodule
db.modulestore.find( { "_id.category" : "course" }, {'name':'1'} )

To remove courses numbered 999 (from all orgs):

db.modulestore.remove({'_id.course': '999'})

--JZ

Jay Zoldak

unread,
Jun 28, 2013, 9:14:59 AM6/28/13
to praveen pal, edx-code
Actually I just looked through the code and realized that deleting from the db directly will leave some cruft in the django db related to groups and permissions.
A better way to do this would be via the management command for deleting courses contained in the file cms/djangoapps/contentstore/management/commands/delete_course.py

To access it, you need to know your course locator string. This will be org/number/display_name. E.g. if my org is MITx, my course number is 999, and my course display name is "My_Foo", then it would be "MITx/999/My_Foo" It's the same as the URL that your course is accessed by. One easy way to discover the URL is to open your course in Studio, and go to the Course Setting / Schedule & Details page. Look at the URL in the Course Summary Page field.

To delete your course, you can access the delete_course command using rake like this:

`rake cms:delete_course "LOC=<locator> commit`

e.g. `rake cms:delete_course LOC=MITx/999/My_Foo commit`

If you leave off "commit" the command will tell you what it is going to do but not do it.

-- JZ

Roshan Piyush

unread,
Jun 28, 2013, 10:05:30 AM6/28/13
to edx-...@googlegroups.com

To delete a course

rake cms:delete_course LOC=<University/Course_ID/Course_NAME> COMMIT=commit

Chris Dodge

unread,
Jun 28, 2013, 11:15:20 AM6/28/13
to edx-...@googlegroups.com, praveen pal
Thanks Jay, yes you are correct it is preferable to use the django-admin command (or the rake wrapper).

Please note this will *not* delete user-related data. So if you had users (either real or test) go through the course, that data will still live in the MySQL database after running that command. So you will have "dangling pointers" from the User data to content which no longer exists.

I'm not sure we have django-admin utilities to go through and drop User data for a course "run", maybe someone else might know. Obviously, if one were to write one, it should be done with care as the only remediation to a faulty purge would be via restoring from any backups.

Patrick Shan

unread,
Jul 22, 2013, 4:46:17 AM7/22/13
to edx-...@googlegroups.com
Hi Roshan,

When I ran this command in console, I came across an error:

(in /opt/wwc/edx-platform)
phantomjs not found on path. Set $PHANTOMJS_PATH. Using browser for jasmine tests
django-admin delete_course --traceback --settings=cms.envs.dev --pythonpath=. edx/8390/edx-platform commit
Unknown command: 'delete_course'
Type 'django-admin help' for usage.
rake aborted!

Any idea ?

Florian D.

unread,
Jul 22, 2013, 6:23:39 AM7/22/13
to edx-...@googlegroups.com
Le lundi 22 juillet 2013 10:46:17 UTC+2, Patrick Shan a écrit :

Unknown command: 'delete_course'
Type 'django-admin help' for usage.
rake aborted!

Hi,

Could you run 'rake -T'? Do you find 'cms:delete_course' in the output?

Patrick Shan

unread,
Jul 22, 2013, 7:27:01 AM7/22/13
to edx-...@googlegroups.com
Hi,

root@online:/opt/wwc/edx-platform# rake -T | grep delete
rake cms:delete_course                          # Delete existing MongoDB based course

yes, there is delete_course in the output.

Patrick Shan

unread,
Jul 22, 2013, 7:50:58 AM7/22/13
to edx-...@googlegroups.com
By the way, I use 'edx' as the <University> part in the command. This is the whole command:

root@online:/opt/wwc/edx-platform# rake cms:delete_course LOC=edx/8390/edx-platform COMMIT=commit

I used edx-configuration to install the whole edx-platform on an ec2 instance. Is the University part right ?

Florian D.

unread,
Jul 24, 2013, 7:56:48 AM7/24/13
to edx-...@googlegroups.com
Le lundi 22 juillet 2013 13:50:58 UTC+2, Patrick Shan a écrit :
By the way, I use 'edx' as the <University> part in the command. This is the whole command:

root@online:/opt/wwc/edx-platform# rake cms:delete_course LOC=edx/8390/edx-platform COMMIT=commit

I used edx-configuration to install the whole edx-platform on an ec2 instance. Is the University part right ?

Of you're unsure, just log into Studio, choose the course you want to delete, Settings -> Schedule & Details : University, Course Number and Course Name will be displayed.

Then you just have to type 'rake cms:delete_course LOC=UNIVERSITY/COURSENUMBER/COURSENAME'.

Sean Murray

unread,
Feb 4, 2014, 7:27:10 PM2/4/14
to edx-...@googlegroups.com
Does "University" in this case equate to the "Organization"?

So for instance, if this is the what the settings & details page looks like: 

THEN:

My command should look like the following: rake cms:delete_course LOC=NA/T1/2014_T1 COMMIT=commit

When I run this, I get the following error (...which may be an environment issue?)


./bin/rake cms:delete_course LOC=NA/T1/2014_T1 COMMIT=commit
./manage.py cms --settings dev delete_course --traceback NA/T1/2014_T1 commit
Traceback (most recent call last):
  File "./manage.py", line 90, in <module>
    startup = importlib.import_module(edx_args.startup)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/edx/app/edxapp/edx-platform/cms/startup.py", line 4, in <module>
    from django.conf import settings
ImportError: No module named django.conf
rake aborted!
Command failed with status (1): [./manage.py cms --settings dev delete_cour...]
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `call'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/file_utils.rb:45:in `sh'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:37:in `sh'
/edx/app/edxapp/edx-platform/rakelib/django.rake:92:in `block (2 levels) in <top (required)>'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/edx/app/edxapp/.gem/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Tasks: TOP => cms:delete_course
(See full trace by running task with --trace)



Thanks for the halp!

Victor Hooi

unread,
Jul 19, 2017, 7:04:54 AM7/19/17
to General Open edX discussion
Hi,

Is this still the definitive way of deleting courses in EDX Studio?


It seems a bit weird that you can create courses via the EDX Web UI - but you can't delete them, and need to run arcane CLI on the server itself to delete them...

I just setup an EDX instance for my wife to play around with and she was completely stumped on how to delete courses, and Google pointed me here. Does anybody know if we added proper functionality to delete courses in EDX  Studio yet since 2014?

Regards,
Victor

vicente rios

unread,
Feb 19, 2019, 3:54:21 AM2/19/19
to General Open edX discussion
I know it is a bit dead but I figure I would answer this question. 

No you can't delete courses from the module store by default. 

Yes, you can delete courses imported by git using the sysadmin section following this slides which also explain how to enable this section. https://github.com/mitodl/git-based-courses-slides

Not planning on switching to git based courses any time soon so it sorta sucks. 

Thinking about hacking up a way to delete courses on the module store from sysadmin since it does list every course. 

Nate Aune

unread,
Feb 19, 2019, 6:34:41 AM2/19/19
to edx-...@googlegroups.com
Maybe this Admin XBlock could help? 

It has a “delete course” option.

--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/34f626bd-ddc9-4c8d-9427-b955f0fa5690%40googlegroups.com.
--

vicente rios

unread,
Feb 19, 2019, 8:39:48 AM2/19/19
to General Open edX discussion
Your suggestion seems ideal I will check it out. 

My team is fairly new to openedx and we have yet to install an xblock somehow so I will try to get them to allow me to try to install this.

Just installing lynx to get the bulk emails working was a bit of an issue...  

Nate Aune

unread,
Feb 19, 2019, 9:21:59 AM2/19/19
to edx-...@googlegroups.com
If you're having challenges getting Open edX up and running, might I suggest a fully managed offering from my company Appsembler? Our Tahoe platform is a hosted and managed edition of Open edX with management tools for easily branding/theming your site, and creating top level pages - all without touching a server or writing any code! You can sign up for a free 30 day trial here: https://appsembler.com/tahoe/ 



vicente rios

unread,
Feb 20, 2019, 4:54:39 AM2/20/19
to General Open edX discussion


We are almost there somehow. 

It is just that to get here we have had some issues here and there and we have stablished some procedures to stop them from happening again which stops me from adding something like an xblock willy-nilly. 

I have had a look at your site and was talking to Krystal earlier today. 

Our site has some specific functionality/design requirements and whatnot that keep changing, the whole deleting courses is merely us trying to get ahead of their demands which keep changing after each presentation, and your platform is a bit too limited for us right now. 

I am aware you are willing to make changes for customers but my hands are tied and my boss has already decided that the best approach is to just throw stuff at the wall and see what sticks which has somehow given us a working edx site that fills our needs as crazy as that sounds. 

I am however extremely grateful some professionals with years of experience like you have been around for a while and have answered most of the issues that have come up over time. 
Reply all
Reply to author
Forward
0 new messages