Delete an application using CMD


due to some errors(form not found), the application page is displaying 500 error. so that we are not able to delete the app using the web interface.

Is there any Django-manage utility to delete an application ?

Hi Demisew

There is no management command but it can be done from a Django shell. Do you know how the application got into this state?

Hi Simon,

thankyou for prompt reply.

The issue occurred due to the file corruption on object storage. the error displayed is something like this.

couchdbkit.exceptions.ResourceNotFound: Application 5fb39c16d2cb4c878355646cf60f61bf attachment: '00acd24598834b859b479f2f19c27da2.xml'

Since the application is test-only, we can delete it. Please share me share the Django-shell script.

Hi Demisew

I've written a script below which you can use. I've also included the method to undo the deletion.

Please note that this code comes with no guarantees or support.

from corehq.apps.app_manager.dbaccessors import get_app
domain = "my_domain"
app_id = "xyz"
app = get_app(domain, app_id)
print(  # verify this is the correct application

# undo as follows:
app = get_app(domain, app_id)
1 Like

Thanks, Simon,

it works