We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
The clear database command should be runnable with debug disabled
We should be able to run `cleardb` when `DEBUG=False` but we should have a `--force` flag to actually allow that action when the debug mode is turned off as it is a dangerous command.

Definition of done:
- Prints an error to stderr when `DEBUG=False` and `--force` is not passed (flagged)
- Exits with 1 (raises `SystemExit` which allows Django to handle it and cleanup the opened connections, such as the database)
- User can clear the database when debug mode is turned off and only when `--force` was passed

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `saleor/core/management/commands/cleardb.py`
Content:
```
1 """Clear the database preserving shop's configuration.
2 
3 This command clears the database from data such as orders, products or customer
4 accounts. It doesn't remove shop's configuration, such as: staff accounts, service
5 accounts, plugin configurations, site settings or navigation menus.
6 """
7 
8 from django.conf import settings
9 from django.core.management.base import BaseCommand, CommandError
10 from django.db.models import Q
11 
12 from ....account.models import User
13 from ....checkout.models import Checkout
14 from ....discount.models import Sale, Voucher
15 from ....giftcard.models import GiftCard
16 from ....order.models import Order
17 from ....page.models import Page
18 from ....payment.models import Payment, Transaction
19 from ....product.models import Attribute, Category, Collection, Product, ProductType
20 from ....shipping.models import ShippingMethod, ShippingZone
21 from ....warehouse.models import Warehouse
22 from ....webhook.models import Webhook
23 
24 
25 class Command(BaseCommand):
26     help = "Removes data from the database preserving shop configuration."
27 
28     def add_arguments(self, parser):
29         parser.add_argument(
30             "--delete-staff",
31             action="store_true",
32             help="Delete staff user accounts (doesn't delete superuser accounts).",
33         )
34 
35     def handle(self, **options):
36         if not settings.DEBUG:
37             raise CommandError("Cannot clear the database in DEBUG=True mode.")
38 
39         Checkout.objects.all().delete()
40         self.stdout.write("Removed checkouts")
41 
42         Transaction.objects.all().delete()
43         self.stdout.write("Removed transactions")
44 
45         Payment.objects.all().delete()
46         self.stdout.write("Removed payments")
47 
48         Order.objects.all().delete()
49         self.stdout.write("Removed orders")
50 
51         Product.objects.all().delete()
52         self.stdout.write("Removed products")
53 
54         ProductType.objects.all().delete()
55         self.stdout.write("Removed product types")
56 
57         Attribute.objects.all().delete()
58         self.stdout.write("Removed attributes")
59 
60         Category.objects.all().delete()
61         self.stdout.write("Removed categories")
62 
63         Collection.objects.all().delete()
64         self.stdout.write("Removed collections")
65 
66         Sale.objects.all().delete()
67         self.stdout.write("Removed sales")
68 
69         ShippingMethod.objects.all().delete()
70         self.stdout.write("Removed shipping methods")
71 
72         ShippingZone.objects.all().delete()
73         self.stdout.write("Removed shipping zones")
74 
75         Voucher.objects.all().delete()
76         self.stdout.write("Removed vouchers")
77 
78         GiftCard.objects.all().delete()
79         self.stdout.write("Removed gift cards")
80 
81         self.stdout.write("Removed warehouses")
82         Warehouse.objects.all().delete()
83 
84         Page.objects.all().delete()
85         self.stdout.write("Removed pages")
86 
87         Webhook.objects.all().delete()
88         self.stdout.write("Removed webhooks")
89 
90         # Delete all users except for staff members.
91         staff = User.objects.filter(Q(is_staff=True) | Q(is_superuser=True))
92         User.objects.exclude(pk__in=staff).delete()
93         self.stdout.write("Removed customers")
94 
95         should_delete_staff = options.get("delete_staff")
96         if should_delete_staff:
97             staff = staff.exclude(is_superuser=True)
98             staff.delete()
99             self.stdout.write("Removed staff users")
100 
101         # Remove addresses of staff members. Used to clear saved addresses of staff
102         # accounts used on demo for testing checkout.
103         for user in staff:
104             user.addresses.all().delete()
105         self.stdout.write("Removed staff addresses")
106
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/saleor/core/management/commands/cleardb.py b/saleor/core/management/commands/cleardb.py
--- a/saleor/core/management/commands/cleardb.py
+++ b/saleor/core/management/commands/cleardb.py
@@ -31,10 +31,16 @@
             action="store_true",
             help="Delete staff user accounts (doesn't delete superuser accounts).",
         )
+        parser.add_argument(
+            "--force",
+            action="store_true",
+            help="Allows running the cleardb command in DEBUG=False mode.",
+        )
 
     def handle(self, **options):
-        if not settings.DEBUG:
-            raise CommandError("Cannot clear the database in DEBUG=True mode.")
+        force = options.get("force", False)
+        if not settings.DEBUG and not force:
+            raise CommandError("Cannot clear the database in DEBUG=False mode.")
 
         Checkout.objects.all().delete()
         self.stdout.write("Removed checkouts")

{"golden_diff": "diff --git a/saleor/core/management/commands/cleardb.py b/saleor/core/management/commands/cleardb.py\n--- a/saleor/core/management/commands/cleardb.py\n+++ b/saleor/core/management/commands/cleardb.py\n@@ -31,10 +31,16 @@\n             action=\"store_true\",\n             help=\"Delete staff user accounts (doesn't delete superuser accounts).\",\n         )\n+        parser.add_argument(\n+            \"--force\",\n+            action=\"store_true\",\n+            help=\"Allows running the cleardb command in DEBUG=False mode.\",\n+        )\n \n     def handle(self, **options):\n-        if not settings.DEBUG:\n-            raise CommandError(\"Cannot clear the database in DEBUG=True mode.\")\n+        force = options.get(\"force\", False)\n+        if not settings.DEBUG and not force:\n+            raise CommandError(\"Cannot clear the database in DEBUG=False mode.\")\n \n         Checkout.objects.all().delete()\n         self.stdout.write(\"Removed checkouts\")\n", "issue": "The clear database command should be runnable with debug disabled\nWe should be able to run `cleardb` when `DEBUG=False` but we should have a `--force` flag to actually allow that action when the debug mode is turned off as it is a dangerous command.\r\n\r\nDefinition of done:\r\n- Prints an error to stderr when `DEBUG=False` and `--force` is not passed (flagged)\r\n- Exits with 1 (raises `SystemExit` which allows Django to handle it and cleanup the opened connections, such as the database)\r\n- User can clear the database when debug mode is turned off and only when `--force` was passed\n", "before_files": [{"content": "\"\"\"Clear the database preserving shop's configuration.\n\nThis command clears the database from data such as orders, products or customer\naccounts. It doesn't remove shop's configuration, such as: staff accounts, service\naccounts, plugin configurations, site settings or navigation menus.\n\"\"\"\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import Q\n\nfrom ....account.models import User\nfrom ....checkout.models import Checkout\nfrom ....discount.models import Sale, Voucher\nfrom ....giftcard.models import GiftCard\nfrom ....order.models import Order\nfrom ....page.models import Page\nfrom ....payment.models import Payment, Transaction\nfrom ....product.models import Attribute, Category, Collection, Product, ProductType\nfrom ....shipping.models import ShippingMethod, ShippingZone\nfrom ....warehouse.models import Warehouse\nfrom ....webhook.models import Webhook\n\n\nclass Command(BaseCommand):\n    help = \"Removes data from the database preserving shop configuration.\"\n\n    def add_arguments(self, parser):\n        parser.add_argument(\n            \"--delete-staff\",\n            action=\"store_true\",\n            help=\"Delete staff user accounts (doesn't delete superuser accounts).\",\n        )\n\n    def handle(self, **options):\n        if not settings.DEBUG:\n            raise CommandError(\"Cannot clear the database in DEBUG=True mode.\")\n\n        Checkout.objects.all().delete()\n        self.stdout.write(\"Removed checkouts\")\n\n        Transaction.objects.all().delete()\n        self.stdout.write(\"Removed transactions\")\n\n        Payment.objects.all().delete()\n        self.stdout.write(\"Removed payments\")\n\n        Order.objects.all().delete()\n        self.stdout.write(\"Removed orders\")\n\n        Product.objects.all().delete()\n        self.stdout.write(\"Removed products\")\n\n        ProductType.objects.all().delete()\n        self.stdout.write(\"Removed product types\")\n\n        Attribute.objects.all().delete()\n        self.stdout.write(\"Removed attributes\")\n\n        Category.objects.all().delete()\n        self.stdout.write(\"Removed categories\")\n\n        Collection.objects.all().delete()\n        self.stdout.write(\"Removed collections\")\n\n        Sale.objects.all().delete()\n        self.stdout.write(\"Removed sales\")\n\n        ShippingMethod.objects.all().delete()\n        self.stdout.write(\"Removed shipping methods\")\n\n        ShippingZone.objects.all().delete()\n        self.stdout.write(\"Removed shipping zones\")\n\n        Voucher.objects.all().delete()\n        self.stdout.write(\"Removed vouchers\")\n\n        GiftCard.objects.all().delete()\n        self.stdout.write(\"Removed gift cards\")\n\n        self.stdout.write(\"Removed warehouses\")\n        Warehouse.objects.all().delete()\n\n        Page.objects.all().delete()\n        self.stdout.write(\"Removed pages\")\n\n        Webhook.objects.all().delete()\n        self.stdout.write(\"Removed webhooks\")\n\n        # Delete all users except for staff members.\n        staff = User.objects.filter(Q(is_staff=True) | Q(is_superuser=True))\n        User.objects.exclude(pk__in=staff).delete()\n        self.stdout.write(\"Removed customers\")\n\n        should_delete_staff = options.get(\"delete_staff\")\n        if should_delete_staff:\n            staff = staff.exclude(is_superuser=True)\n            staff.delete()\n            self.stdout.write(\"Removed staff users\")\n\n        # Remove addresses of staff members. Used to clear saved addresses of staff\n        # accounts used on demo for testing checkout.\n        for user in staff:\n            user.addresses.all().delete()\n        self.stdout.write(\"Removed staff addresses\")\n", "path": "saleor/core/management/commands/cleardb.py"}], "after_files": [{"content": "\"\"\"Clear the database preserving shop's configuration.\n\nThis command clears the database from data such as orders, products or customer\naccounts. It doesn't remove shop's configuration, such as: staff accounts, service\naccounts, plugin configurations, site settings or navigation menus.\n\"\"\"\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import Q\n\nfrom ....account.models import User\nfrom ....checkout.models import Checkout\nfrom ....discount.models import Sale, Voucher\nfrom ....giftcard.models import GiftCard\nfrom ....order.models import Order\nfrom ....page.models import Page\nfrom ....payment.models import Payment, Transaction\nfrom ....product.models import Attribute, Category, Collection, Product, ProductType\nfrom ....shipping.models import ShippingMethod, ShippingZone\nfrom ....warehouse.models import Warehouse\nfrom ....webhook.models import Webhook\n\n\nclass Command(BaseCommand):\n    help = \"Removes data from the database preserving shop configuration.\"\n\n    def add_arguments(self, parser):\n        parser.add_argument(\n            \"--delete-staff\",\n            action=\"store_true\",\n            help=\"Delete staff user accounts (doesn't delete superuser accounts).\",\n        )\n        parser.add_argument(\n            \"--force\",\n            action=\"store_true\",\n            help=\"Allows running the cleardb command in DEBUG=False mode.\",\n        )\n\n    def handle(self, **options):\n        force = options.get(\"force\", False)\n        if not settings.DEBUG and not force:\n            raise CommandError(\"Cannot clear the database in DEBUG=False mode.\")\n\n        Checkout.objects.all().delete()\n        self.stdout.write(\"Removed checkouts\")\n\n        Transaction.objects.all().delete()\n        self.stdout.write(\"Removed transactions\")\n\n        Payment.objects.all().delete()\n        self.stdout.write(\"Removed payments\")\n\n        Order.objects.all().delete()\n        self.stdout.write(\"Removed orders\")\n\n        Product.objects.all().delete()\n        self.stdout.write(\"Removed products\")\n\n        ProductType.objects.all().delete()\n        self.stdout.write(\"Removed product types\")\n\n        Attribute.objects.all().delete()\n        self.stdout.write(\"Removed attributes\")\n\n        Category.objects.all().delete()\n        self.stdout.write(\"Removed categories\")\n\n        Collection.objects.all().delete()\n        self.stdout.write(\"Removed collections\")\n\n        Sale.objects.all().delete()\n        self.stdout.write(\"Removed sales\")\n\n        ShippingMethod.objects.all().delete()\n        self.stdout.write(\"Removed shipping methods\")\n\n        ShippingZone.objects.all().delete()\n        self.stdout.write(\"Removed shipping zones\")\n\n        Voucher.objects.all().delete()\n        self.stdout.write(\"Removed vouchers\")\n\n        GiftCard.objects.all().delete()\n        self.stdout.write(\"Removed gift cards\")\n\n        self.stdout.write(\"Removed warehouses\")\n        Warehouse.objects.all().delete()\n\n        Page.objects.all().delete()\n        self.stdout.write(\"Removed pages\")\n\n        Webhook.objects.all().delete()\n        self.stdout.write(\"Removed webhooks\")\n\n        # Delete all users except for staff members.\n        staff = User.objects.filter(Q(is_staff=True) | Q(is_superuser=True))\n        User.objects.exclude(pk__in=staff).delete()\n        self.stdout.write(\"Removed customers\")\n\n        should_delete_staff = options.get(\"delete_staff\")\n        if should_delete_staff:\n            staff = staff.exclude(is_superuser=True)\n            staff.delete()\n            self.stdout.write(\"Removed staff users\")\n\n        # Remove addresses of staff members. Used to clear saved addresses of staff\n        # accounts used on demo for testing checkout.\n        for user in staff:\n            user.addresses.all().delete()\n        self.stdout.write(\"Removed staff addresses\")\n", "path": "saleor/core/management/commands/cleardb.py"}]}