prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  checkoutCreate mutation issue -   { "code": "REQUIRED",  "field": "country",  "message": "This field cannot be blank." }
  ### What I'm trying to achieve
  try to add checkout step with createCheckout mutation.
  
  ### Steps to reproduce the problem
  <!-- Adding logs from the console, as well as query/response help us fix the bug faster -->
  1. use docker-platform, deploy with docker compose, delete saleor folder and replace it by saleor folder with 3.1 branch clone
  2. use playgraphl to test mutation request (checkoutCreate)
  
  ### What I expected to happen
  i make test on saleor demo site : https://demo.saleor.io/graphql/
  
  ```bash
  mutation CheckoutCreate {
    checkoutCreate(
      input: { channel: "default-channel", email: "john@example.com", lines: [] }
    ) 
    {  errors {
          code
          field
          message
        }
      checkout {
        id
        token
        created
         
      }
    }
  }
  
  ```
  result on : https://demo.saleor.io/graphql/
  ```bash
  {
    "data": {
      "checkoutCreate": {
        "errors": [],
        "checkout": {
          "id": "Q2hlY2tvdXQ6MDQ2MmQwMzQtZGJmYi00MTg1LWExZTMtMWUwYTU2YWMxYjJi",
          "token": "0462d034-dbfb-4185-a1e3-1e0a56ac1b2b",
          "created": "2021-09-17T13:17:33.994853+00:00"
        }
      }
    }
  }
  
  
  ```
  
  # this is fine for me but ....
  When i try the samething on my local machine (deploy with docker compose)
  i get this:
  
  ```bash
  
  {
    "data": {
      "checkoutCreate": {
        "errors": [
          {
            "code": "REQUIRED",
            "field": "country",
            "message": "This field cannot be blank."
          }
        ],
        "checkout": null
      }
    }
  }
  
  ```
  i want to get checkoutID and token and the system ask me to add some country field.....
  
  **System information**
  <!-- Provide the version of Saleor or whether you're using it from the `master` branch. If using Saleor Dashboard or Storefront, provide their versions too. -->
  Saleor version:
  - [ ] dev (current master)
  - [ X] 3.0
  - [ ] 2.11
  - [ ] 2.10
  
  Operating system:
  - [ ] Windows
  - [ X] Linux
  - [ ] MacOS
  - [ ] Other
  
  
  --- 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/channel/migrations/0001_initial.py`
  Content:
  ```
  1 # Generated by Django 3.0.6 on 2020-06-16 07:54
  2 
  3 from django.conf import settings
  4 from django.db import migrations, models
  5 from django.db.models.signals import post_migrate
  6 from django.apps import apps as registry
  7 
  8 
  9 def assing_permissions(apps, schema_editor):
  10     def on_migrations_complete(sender=None, **kwargs):
  11         Group = apps.get_model("auth", "Group")
  12         Permission = apps.get_model("auth", "Permission")
  13         ContentType = apps.get_model("contenttypes", "ContentType")
  14 
  15         ct, _ = ContentType.objects.get_or_create(app_label="channel", model="channel")
  16         manage_channels, _ = Permission.objects.get_or_create(
  17             name="Manage channels.", content_type=ct, codename="manage_channels"
  18         )
  19 
  20         for group in Group.objects.iterator():
  21             group.permissions.add(manage_channels)
  22 
  23     sender = registry.get_app_config("channel")
  24     post_migrate.connect(on_migrations_complete, weak=False, sender=sender)
  25 
  26 
  27 def get_default_currency(Checkout, Order, Product, ShippingMethod, Voucher):
  28     latest_product = Product.objects.order_by("-pk").first()
  29     if latest_product:
  30         return latest_product.currency
  31     latest_voucher = Voucher.objects.order_by("-pk").first()
  32     if latest_voucher:
  33         return latest_voucher.currency
  34     latest_shipping_method = ShippingMethod.objects.order_by("-pk").first()
  35     if latest_shipping_method:
  36         return latest_shipping_method.currency
  37     latest_order = Order.objects.order_by("-pk").first()
  38     if latest_order:
  39         return latest_order.currency
  40     latest_checkout = Checkout.objects.order_by("-pk").first()
  41     if latest_checkout:
  42         return latest_checkout.currency
  43     return None
  44 
  45 
  46 def create_default_channel(apps, schema_editor):
  47     Channel = apps.get_model("channel", "Channel")
  48     Checkout = apps.get_model("checkout", "Checkout")
  49     Order = apps.get_model("order", "Order")
  50     Product = apps.get_model("product", "Product")
  51     ShippingMethod = apps.get_model("shipping", "ShippingMethod")
  52     Voucher = apps.get_model("discount", "Voucher")
  53 
  54     default_currency = get_default_currency(
  55         Checkout, Order, Product, ShippingMethod, Voucher
  56     )
  57     if default_currency:
  58         Channel.objects.create(
  59             name="Default channel",
  60             slug=settings.DEFAULT_CHANNEL_SLUG,
  61             currency_code=default_currency,
  62             is_active=True,
  63         )
  64 
  65 
  66 class Migration(migrations.Migration):
  67 
  68     initial = True
  69 
  70     dependencies = [
  71         ("checkout", "0025_auto_20200221_0257"),
  72         ("discount", "0019_auto_20200217_0350"),
  73         ("order", "0084_auto_20200522_0522"),
  74         ("product", "0118_populate_product_variant_price"),
  75         ("shipping", "0018_default_zones_countries"),
  76     ]
  77 
  78     operations = [
  79         migrations.CreateModel(
  80             name="Channel",
  81             fields=[
  82                 (
  83                     "id",
  84                     models.AutoField(
  85                         auto_created=True,
  86                         primary_key=True,
  87                         serialize=False,
  88                         verbose_name="ID",
  89                     ),
  90                 ),
  91                 ("name", models.CharField(max_length=250)),
  92                 ("slug", models.SlugField(max_length=255, unique=True)),
  93                 ("is_active", models.BooleanField(default=False)),
  94                 (
  95                     "currency_code",
  96                     models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH),
  97                 ),
  98             ],
  99             options={
  100                 "ordering": ("slug",),
  101                 "permissions": (("manage_channels", "Manage channels."),),
  102             },
  103         ),
  104         migrations.RunPython(create_default_channel, migrations.RunPython.noop),
  105         migrations.RunPython(assing_permissions, migrations.RunPython.noop),
  106     ]
  107
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/saleor/channel/migrations/0001_initial.py b/saleor/channel/migrations/0001_initial.py
  --- a/saleor/channel/migrations/0001_initial.py
  +++ b/saleor/channel/migrations/0001_initial.py
  @@ -1,5 +1,6 @@
   # Generated by Django 3.0.6 on 2020-06-16 07:54
   
  +import os
   from django.conf import settings
   from django.db import migrations, models
   from django.db.models.signals import post_migrate
  @@ -54,12 +55,14 @@
       default_currency = get_default_currency(
           Checkout, Order, Product, ShippingMethod, Voucher
       )
  +    default_country = os.environ.get("DEFAULT_COUNTRY", "US")
       if default_currency:
           Channel.objects.create(
               name="Default channel",
               slug=settings.DEFAULT_CHANNEL_SLUG,
               currency_code=default_currency,
               is_active=True,
  +            default_country=default_country,
           )
  
verification_info: {"golden_diff": "diff --git a/saleor/channel/migrations/0001_initial.py b/saleor/channel/migrations/0001_initial.py\n--- a/saleor/channel/migrations/0001_initial.py\n+++ b/saleor/channel/migrations/0001_initial.py\n@@ -1,5 +1,6 @@\n # Generated by Django 3.0.6 on 2020-06-16 07:54\n \n+import os\n from django.conf import settings\n from django.db import migrations, models\n from django.db.models.signals import post_migrate\n@@ -54,12 +55,14 @@\n     default_currency = get_default_currency(\n         Checkout, Order, Product, ShippingMethod, Voucher\n     )\n+    default_country = os.environ.get(\"DEFAULT_COUNTRY\", \"US\")\n     if default_currency:\n         Channel.objects.create(\n             name=\"Default channel\",\n             slug=settings.DEFAULT_CHANNEL_SLUG,\n             currency_code=default_currency,\n             is_active=True,\n+            default_country=default_country,\n         )\n", "issue": "checkoutCreate mutation issue -   { \"code\": \"REQUIRED\",  \"field\": \"country\",  \"message\": \"This field cannot be blank.\" }\n### What I'm trying to achieve\r\ntry to add checkout step with createCheckout mutation.\r\n\r\n### Steps to reproduce the problem\r\n<!-- Adding logs from the console, as well as query/response help us fix the bug faster -->\r\n1. use docker-platform, deploy with docker compose, delete saleor folder and replace it by saleor folder with 3.1 branch clone\r\n2. use playgraphl to test mutation request (checkoutCreate)\r\n\r\n### What I expected to happen\r\ni make test on saleor demo site : https://demo.saleor.io/graphql/\r\n\r\n```bash\r\nmutation CheckoutCreate {\r\n  checkoutCreate(\r\n    input: { channel: \"default-channel\", email: \"john@example.com\", lines: [] }\r\n  ) \r\n  {  errors {\r\n        code\r\n        field\r\n        message\r\n      }\r\n    checkout {\r\n      id\r\n      token\r\n      created\r\n       \r\n    }\r\n  }\r\n}\r\n\r\n```\r\nresult on : https://demo.saleor.io/graphql/\r\n```bash\r\n{\r\n  \"data\": {\r\n    \"checkoutCreate\": {\r\n      \"errors\": [],\r\n      \"checkout\": {\r\n        \"id\": \"Q2hlY2tvdXQ6MDQ2MmQwMzQtZGJmYi00MTg1LWExZTMtMWUwYTU2YWMxYjJi\",\r\n        \"token\": \"0462d034-dbfb-4185-a1e3-1e0a56ac1b2b\",\r\n        \"created\": \"2021-09-17T13:17:33.994853+00:00\"\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\n```\r\n\r\n# this is fine for me but ....\r\nWhen i try the samething on my local machine (deploy with docker compose)\r\ni get this:\r\n\r\n```bash\r\n\r\n{\r\n  \"data\": {\r\n    \"checkoutCreate\": {\r\n      \"errors\": [\r\n        {\r\n          \"code\": \"REQUIRED\",\r\n          \"field\": \"country\",\r\n          \"message\": \"This field cannot be blank.\"\r\n        }\r\n      ],\r\n      \"checkout\": null\r\n    }\r\n  }\r\n}\r\n\r\n```\r\ni want to get checkoutID and token and the system ask me to add some country field.....\r\n\r\n**System information**\r\n<!-- Provide the version of Saleor or whether you're using it from the `master` branch. If using Saleor Dashboard or Storefront, provide their versions too. -->\r\nSaleor version:\r\n- [ ] dev (current master)\r\n- [ X] 3.0\r\n- [ ] 2.11\r\n- [ ] 2.10\r\n\r\nOperating system:\r\n- [ ] Windows\r\n- [ X] Linux\r\n- [ ] MacOS\r\n- [ ] Other\r\n\n", "before_files": [{"content": "# Generated by Django 3.0.6 on 2020-06-16 07:54\n\nfrom django.conf import settings\nfrom django.db import migrations, models\nfrom django.db.models.signals import post_migrate\nfrom django.apps import apps as registry\n\n\ndef assing_permissions(apps, schema_editor):\n    def on_migrations_complete(sender=None, **kwargs):\n        Group = apps.get_model(\"auth\", \"Group\")\n        Permission = apps.get_model(\"auth\", \"Permission\")\n        ContentType = apps.get_model(\"contenttypes\", \"ContentType\")\n\n        ct, _ = ContentType.objects.get_or_create(app_label=\"channel\", model=\"channel\")\n        manage_channels, _ = Permission.objects.get_or_create(\n            name=\"Manage channels.\", content_type=ct, codename=\"manage_channels\"\n        )\n\n        for group in Group.objects.iterator():\n            group.permissions.add(manage_channels)\n\n    sender = registry.get_app_config(\"channel\")\n    post_migrate.connect(on_migrations_complete, weak=False, sender=sender)\n\n\ndef get_default_currency(Checkout, Order, Product, ShippingMethod, Voucher):\n    latest_product = Product.objects.order_by(\"-pk\").first()\n    if latest_product:\n        return latest_product.currency\n    latest_voucher = Voucher.objects.order_by(\"-pk\").first()\n    if latest_voucher:\n        return latest_voucher.currency\n    latest_shipping_method = ShippingMethod.objects.order_by(\"-pk\").first()\n    if latest_shipping_method:\n        return latest_shipping_method.currency\n    latest_order = Order.objects.order_by(\"-pk\").first()\n    if latest_order:\n        return latest_order.currency\n    latest_checkout = Checkout.objects.order_by(\"-pk\").first()\n    if latest_checkout:\n        return latest_checkout.currency\n    return None\n\n\ndef create_default_channel(apps, schema_editor):\n    Channel = apps.get_model(\"channel\", \"Channel\")\n    Checkout = apps.get_model(\"checkout\", \"Checkout\")\n    Order = apps.get_model(\"order\", \"Order\")\n    Product = apps.get_model(\"product\", \"Product\")\n    ShippingMethod = apps.get_model(\"shipping\", \"ShippingMethod\")\n    Voucher = apps.get_model(\"discount\", \"Voucher\")\n\n    default_currency = get_default_currency(\n        Checkout, Order, Product, ShippingMethod, Voucher\n    )\n    if default_currency:\n        Channel.objects.create(\n            name=\"Default channel\",\n            slug=settings.DEFAULT_CHANNEL_SLUG,\n            currency_code=default_currency,\n            is_active=True,\n        )\n\n\nclass Migration(migrations.Migration):\n\n    initial = True\n\n    dependencies = [\n        (\"checkout\", \"0025_auto_20200221_0257\"),\n        (\"discount\", \"0019_auto_20200217_0350\"),\n        (\"order\", \"0084_auto_20200522_0522\"),\n        (\"product\", \"0118_populate_product_variant_price\"),\n        (\"shipping\", \"0018_default_zones_countries\"),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name=\"Channel\",\n            fields=[\n                (\n                    \"id\",\n                    models.AutoField(\n                        auto_created=True,\n                        primary_key=True,\n                        serialize=False,\n                        verbose_name=\"ID\",\n                    ),\n                ),\n                (\"name\", models.CharField(max_length=250)),\n                (\"slug\", models.SlugField(max_length=255, unique=True)),\n                (\"is_active\", models.BooleanField(default=False)),\n                (\n                    \"currency_code\",\n                    models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH),\n                ),\n            ],\n            options={\n                \"ordering\": (\"slug\",),\n                \"permissions\": ((\"manage_channels\", \"Manage channels.\"),),\n            },\n        ),\n        migrations.RunPython(create_default_channel, migrations.RunPython.noop),\n        migrations.RunPython(assing_permissions, migrations.RunPython.noop),\n    ]\n", "path": "saleor/channel/migrations/0001_initial.py"}], "after_files": [{"content": "# Generated by Django 3.0.6 on 2020-06-16 07:54\n\nimport os\nfrom django.conf import settings\nfrom django.db import migrations, models\nfrom django.db.models.signals import post_migrate\nfrom django.apps import apps as registry\n\n\ndef assing_permissions(apps, schema_editor):\n    def on_migrations_complete(sender=None, **kwargs):\n        Group = apps.get_model(\"auth\", \"Group\")\n        Permission = apps.get_model(\"auth\", \"Permission\")\n        ContentType = apps.get_model(\"contenttypes\", \"ContentType\")\n\n        ct, _ = ContentType.objects.get_or_create(app_label=\"channel\", model=\"channel\")\n        manage_channels, _ = Permission.objects.get_or_create(\n            name=\"Manage channels.\", content_type=ct, codename=\"manage_channels\"\n        )\n\n        for group in Group.objects.iterator():\n            group.permissions.add(manage_channels)\n\n    sender = registry.get_app_config(\"channel\")\n    post_migrate.connect(on_migrations_complete, weak=False, sender=sender)\n\n\ndef get_default_currency(Checkout, Order, Product, ShippingMethod, Voucher):\n    latest_product = Product.objects.order_by(\"-pk\").first()\n    if latest_product:\n        return latest_product.currency\n    latest_voucher = Voucher.objects.order_by(\"-pk\").first()\n    if latest_voucher:\n        return latest_voucher.currency\n    latest_shipping_method = ShippingMethod.objects.order_by(\"-pk\").first()\n    if latest_shipping_method:\n        return latest_shipping_method.currency\n    latest_order = Order.objects.order_by(\"-pk\").first()\n    if latest_order:\n        return latest_order.currency\n    latest_checkout = Checkout.objects.order_by(\"-pk\").first()\n    if latest_checkout:\n        return latest_checkout.currency\n    return None\n\n\ndef create_default_channel(apps, schema_editor):\n    Channel = apps.get_model(\"channel\", \"Channel\")\n    Checkout = apps.get_model(\"checkout\", \"Checkout\")\n    Order = apps.get_model(\"order\", \"Order\")\n    Product = apps.get_model(\"product\", \"Product\")\n    ShippingMethod = apps.get_model(\"shipping\", \"ShippingMethod\")\n    Voucher = apps.get_model(\"discount\", \"Voucher\")\n\n    default_currency = get_default_currency(\n        Checkout, Order, Product, ShippingMethod, Voucher\n    )\n    default_country = os.environ.get(\"DEFAULT_COUNTRY\", \"US\")\n    if default_currency:\n        Channel.objects.create(\n            name=\"Default channel\",\n            slug=settings.DEFAULT_CHANNEL_SLUG,\n            currency_code=default_currency,\n            is_active=True,\n            default_country=default_country,\n        )\n\n\nclass Migration(migrations.Migration):\n\n    initial = True\n\n    dependencies = [\n        (\"checkout\", \"0025_auto_20200221_0257\"),\n        (\"discount\", \"0019_auto_20200217_0350\"),\n        (\"order\", \"0084_auto_20200522_0522\"),\n        (\"product\", \"0118_populate_product_variant_price\"),\n        (\"shipping\", \"0018_default_zones_countries\"),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name=\"Channel\",\n            fields=[\n                (\n                    \"id\",\n                    models.AutoField(\n                        auto_created=True,\n                        primary_key=True,\n                        serialize=False,\n                        verbose_name=\"ID\",\n                    ),\n                ),\n                (\"name\", models.CharField(max_length=250)),\n                (\"slug\", models.SlugField(max_length=255, unique=True)),\n                (\"is_active\", models.BooleanField(default=False)),\n                (\n                    \"currency_code\",\n                    models.CharField(max_length=settings.DEFAULT_CURRENCY_CODE_LENGTH),\n                ),\n            ],\n            options={\n                \"ordering\": (\"slug\",),\n                \"permissions\": ((\"manage_channels\", \"Manage channels.\"),),\n            },\n        ),\n        migrations.RunPython(create_default_channel, migrations.RunPython.noop),\n        migrations.RunPython(assing_permissions, migrations.RunPython.noop),\n    ]\n", "path": "saleor/channel/migrations/0001_initial.py"}]}