prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  cliquet.storage.exceptions.BackendError: ConnectionError: Error 8 connecting to localhos:6379
  The config wizard has typos:
  
  https://github.com/Kinto/kinto/blob/master/kinto/config/__init__.py#L39
  https://github.com/Kinto/kinto/blob/master/kinto/config/__init__.py#L41
  https://github.com/Kinto/kinto/blob/master/kinto/config/__init__.py#L43
  
  I am not sure how, but maybe we could have a way to test that the produced default config works
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kinto/config/__init__.py`
  Content:
  ```
  1 import os
  2 import binascii
  3 import codecs
  4 from six.moves import input
  5 
  6 HERE = os.path.abspath(os.path.dirname(__file__))
  7 
  8 
  9 def render_template(template, destination, **kwargs):
  10     template = os.path.join(HERE, template)
  11 
  12     with codecs.open(template, 'r', encoding='utf-8') as f:
  13         raw_template = f.read()
  14         rendered = raw_template.format(**kwargs)
  15         with codecs.open(destination, 'w+', encoding='utf-8') as output:
  16             output.write(rendered)
  17 
  18 
  19 def init(config_file):
  20     values = {}
  21     values['secret'] = binascii.b2a_hex(os.urandom(32))
  22 
  23     backend = input("Which backend to use? "
  24                     "(1 - postgresql, 2 - redis, default - memory) ").strip()
  25 
  26     if backend == '1':
  27         # Postgresql configuration
  28         postgresql_url = "postgres://postgres:postgres@localhost/postgres"
  29         values['storage_backend'] = "cliquet.storage.postgresql"
  30         values['storage_url'] = postgresql_url
  31         values['cache_backend'] = "cliquet.cache.postgresql"
  32         values['cache_url'] = postgresql_url
  33         values['permission_backend'] = "cliquet.permission.postgresql"
  34         values['permission_url'] = postgresql_url
  35 
  36     elif backend == '2':
  37         # Redis configuration
  38         values['storage_backend'] = "cliquet.storage.redis"
  39         values['storage_url'] = "redis://localhos:6379/1"
  40         values['cache_backend'] = "cliquet.cache.redis"
  41         values['cache_url'] = "redis://localhos:6379/2"
  42         values['permission_backend'] = "cliquet.permission.redis"
  43         values['permission_url'] = "redis://localhos:6379/3"
  44 
  45     else:
  46         # Memory configuration / default backend
  47         values['storage_backend'] = "cliquet.storage.memory"
  48         values['storage_url'] = ""
  49         values['cache_backend'] = "cliquet.cache.memory"
  50         values['cache_url'] = ""
  51         values['permission_backend'] = "cliquet.permission.memory"
  52         values['permission_url'] = ""
  53 
  54     render_template("kinto.tpl", config_file,
  55                     secret=values['secret'],
  56                     storage_backend=values['storage_backend'],
  57                     storage_url=values['storage_url'],
  58                     cache_backend=values['cache_backend'],
  59                     cache_url=values['cache_url'],
  60                     permission_backend=values['permission_backend'],
  61                     permission_url=values['permission_url'])
  62
  ```
  --- 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/kinto/config/__init__.py b/kinto/config/__init__.py
  --- a/kinto/config/__init__.py
  +++ b/kinto/config/__init__.py
  @@ -36,11 +36,11 @@
       elif backend == '2':
           # Redis configuration
           values['storage_backend'] = "cliquet.storage.redis"
  -        values['storage_url'] = "redis://localhos:6379/1"
  +        values['storage_url'] = "redis://localhost:6379/1"
           values['cache_backend'] = "cliquet.cache.redis"
  -        values['cache_url'] = "redis://localhos:6379/2"
  +        values['cache_url'] = "redis://localhost:6379/2"
           values['permission_backend'] = "cliquet.permission.redis"
  -        values['permission_url'] = "redis://localhos:6379/3"
  +        values['permission_url'] = "redis://localhost:6379/3"
   
       else:
           # Memory configuration / default backend
  @@ -51,11 +51,4 @@
           values['permission_backend'] = "cliquet.permission.memory"
           values['permission_url'] = ""
   
  -    render_template("kinto.tpl", config_file,
  -                    secret=values['secret'],
  -                    storage_backend=values['storage_backend'],
  -                    storage_url=values['storage_url'],
  -                    cache_backend=values['cache_backend'],
  -                    cache_url=values['cache_url'],
  -                    permission_backend=values['permission_backend'],
  -                    permission_url=values['permission_url'])
  +    render_template("kinto.tpl", config_file, **values)
  
verification_info: {"golden_diff": "diff --git a/kinto/config/__init__.py b/kinto/config/__init__.py\n--- a/kinto/config/__init__.py\n+++ b/kinto/config/__init__.py\n@@ -36,11 +36,11 @@\n     elif backend == '2':\n         # Redis configuration\n         values['storage_backend'] = \"cliquet.storage.redis\"\n-        values['storage_url'] = \"redis://localhos:6379/1\"\n+        values['storage_url'] = \"redis://localhost:6379/1\"\n         values['cache_backend'] = \"cliquet.cache.redis\"\n-        values['cache_url'] = \"redis://localhos:6379/2\"\n+        values['cache_url'] = \"redis://localhost:6379/2\"\n         values['permission_backend'] = \"cliquet.permission.redis\"\n-        values['permission_url'] = \"redis://localhos:6379/3\"\n+        values['permission_url'] = \"redis://localhost:6379/3\"\n \n     else:\n         # Memory configuration / default backend\n@@ -51,11 +51,4 @@\n         values['permission_backend'] = \"cliquet.permission.memory\"\n         values['permission_url'] = \"\"\n \n-    render_template(\"kinto.tpl\", config_file,\n-                    secret=values['secret'],\n-                    storage_backend=values['storage_backend'],\n-                    storage_url=values['storage_url'],\n-                    cache_backend=values['cache_backend'],\n-                    cache_url=values['cache_url'],\n-                    permission_backend=values['permission_backend'],\n-                    permission_url=values['permission_url'])\n+    render_template(\"kinto.tpl\", config_file, **values)\n", "issue": "cliquet.storage.exceptions.BackendError: ConnectionError: Error 8 connecting to localhos:6379\nThe config wizard has typos:\n\nhttps://github.com/Kinto/kinto/blob/master/kinto/config/__init__.py#L39\nhttps://github.com/Kinto/kinto/blob/master/kinto/config/__init__.py#L41\nhttps://github.com/Kinto/kinto/blob/master/kinto/config/__init__.py#L43\n\nI am not sure how, but maybe we could have a way to test that the produced default config works\n\n", "before_files": [{"content": "import os\nimport binascii\nimport codecs\nfrom six.moves import input\n\nHERE = os.path.abspath(os.path.dirname(__file__))\n\n\ndef render_template(template, destination, **kwargs):\n    template = os.path.join(HERE, template)\n\n    with codecs.open(template, 'r', encoding='utf-8') as f:\n        raw_template = f.read()\n        rendered = raw_template.format(**kwargs)\n        with codecs.open(destination, 'w+', encoding='utf-8') as output:\n            output.write(rendered)\n\n\ndef init(config_file):\n    values = {}\n    values['secret'] = binascii.b2a_hex(os.urandom(32))\n\n    backend = input(\"Which backend to use? \"\n                    \"(1 - postgresql, 2 - redis, default - memory) \").strip()\n\n    if backend == '1':\n        # Postgresql configuration\n        postgresql_url = \"postgres://postgres:postgres@localhost/postgres\"\n        values['storage_backend'] = \"cliquet.storage.postgresql\"\n        values['storage_url'] = postgresql_url\n        values['cache_backend'] = \"cliquet.cache.postgresql\"\n        values['cache_url'] = postgresql_url\n        values['permission_backend'] = \"cliquet.permission.postgresql\"\n        values['permission_url'] = postgresql_url\n\n    elif backend == '2':\n        # Redis configuration\n        values['storage_backend'] = \"cliquet.storage.redis\"\n        values['storage_url'] = \"redis://localhos:6379/1\"\n        values['cache_backend'] = \"cliquet.cache.redis\"\n        values['cache_url'] = \"redis://localhos:6379/2\"\n        values['permission_backend'] = \"cliquet.permission.redis\"\n        values['permission_url'] = \"redis://localhos:6379/3\"\n\n    else:\n        # Memory configuration / default backend\n        values['storage_backend'] = \"cliquet.storage.memory\"\n        values['storage_url'] = \"\"\n        values['cache_backend'] = \"cliquet.cache.memory\"\n        values['cache_url'] = \"\"\n        values['permission_backend'] = \"cliquet.permission.memory\"\n        values['permission_url'] = \"\"\n\n    render_template(\"kinto.tpl\", config_file,\n                    secret=values['secret'],\n                    storage_backend=values['storage_backend'],\n                    storage_url=values['storage_url'],\n                    cache_backend=values['cache_backend'],\n                    cache_url=values['cache_url'],\n                    permission_backend=values['permission_backend'],\n                    permission_url=values['permission_url'])\n", "path": "kinto/config/__init__.py"}], "after_files": [{"content": "import os\nimport binascii\nimport codecs\nfrom six.moves import input\n\nHERE = os.path.abspath(os.path.dirname(__file__))\n\n\ndef render_template(template, destination, **kwargs):\n    template = os.path.join(HERE, template)\n\n    with codecs.open(template, 'r', encoding='utf-8') as f:\n        raw_template = f.read()\n        rendered = raw_template.format(**kwargs)\n        with codecs.open(destination, 'w+', encoding='utf-8') as output:\n            output.write(rendered)\n\n\ndef init(config_file):\n    values = {}\n    values['secret'] = binascii.b2a_hex(os.urandom(32))\n\n    backend = input(\"Which backend to use? \"\n                    \"(1 - postgresql, 2 - redis, default - memory) \").strip()\n\n    if backend == '1':\n        # Postgresql configuration\n        postgresql_url = \"postgres://postgres:postgres@localhost/postgres\"\n        values['storage_backend'] = \"cliquet.storage.postgresql\"\n        values['storage_url'] = postgresql_url\n        values['cache_backend'] = \"cliquet.cache.postgresql\"\n        values['cache_url'] = postgresql_url\n        values['permission_backend'] = \"cliquet.permission.postgresql\"\n        values['permission_url'] = postgresql_url\n\n    elif backend == '2':\n        # Redis configuration\n        values['storage_backend'] = \"cliquet.storage.redis\"\n        values['storage_url'] = \"redis://localhost:6379/1\"\n        values['cache_backend'] = \"cliquet.cache.redis\"\n        values['cache_url'] = \"redis://localhost:6379/2\"\n        values['permission_backend'] = \"cliquet.permission.redis\"\n        values['permission_url'] = \"redis://localhost:6379/3\"\n\n    else:\n        # Memory configuration / default backend\n        values['storage_backend'] = \"cliquet.storage.memory\"\n        values['storage_url'] = \"\"\n        values['cache_backend'] = \"cliquet.cache.memory\"\n        values['cache_url'] = \"\"\n        values['permission_backend'] = \"cliquet.permission.memory\"\n        values['permission_url'] = \"\"\n\n    render_template(\"kinto.tpl\", config_file, **values)\n", "path": "kinto/config/__init__.py"}]}