title: OSError at /app/ Why does such a strange error happen?
body: <p>I got an error:</p>
  <blockquote>
  <p>OSError at /app/</p>
  <p>[Errno 63] File name too long: &quot;/Users/xxx/testapp/templates/jinja2/{'items': [{'---': '---', ‘A’: ‘a’, ‘B’: ‘b’, ‘C: ‘c’, ‘D’: ‘d’}]}</p>
  </blockquote>
  <p>I wanna embed <code>json_dict</code> of json_parse method's result in <code>views.py</code> to <code>index.html</code>. I wrote in <code>views.py</code> like</p>
  <pre><code>from django.shortcuts import render
  import json
  
  def index(request):
      f = open('./data/data.json', 'r')
      json_dict = json.load(f)
      return render('./index.html',json_dict)
  </code></pre>
  <p>I wrote in index.html like</p>
  <pre><code>&lt;html&gt;
  　&lt;head&gt;
  　&lt;script type=&quot;text/javascript&quot; src=&quot;//code.jquery.com/jquery-1.11.0.min.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;//cdnjs.cloudflare.com/ajax/libs/chosen/1.8.2/chosen.jquery.min.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;//cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.jquery.js&quot;&gt;&lt;/script&gt;
  　&lt;link rel=&quot;stylesheet&quot; href=&quot;//cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.css&quot;&gt;
  　&lt;/head&gt;
  　&lt;body&gt;
      &lt;select id=&quot;mainDD&quot; data-placeholder=&quot;Choose&quot; class=&quot;chzn-select&quot; style=&quot;width:600px;&quot;&gt;
      {% for k, v in json_dict.items %}
              &lt;option&gt;{{ v }}&lt;/option&gt;
      {% endfor %}
      &lt;/select&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p><code>json_dict</code> has dictionary of <code>{'items': [{'---': '---' ~~~ </code>.I really cannot understand why I cannot send <code>json_dict</code> to <code>index.html</code>. Am I wrong to use render method? How can I fix this?</p>
  <p>urls.py of app(child app) has views.py&amp;index.html is</p>
  <pre><code>from django.conf.urls import url
  from . import views
  
  
  urlpatterns = [
      url(r'^$', views.index, name='index'),
  ]
  </code></pre>
  <p>urls.py of parent app is</p>
  <pre><code>from django.conf.urls import include, url
  from django.contrib import admin
  
  urlpatterns = [
      url(r'^admin/', include(admin.site.urls)),
      url(r'^app/', include('app.urls')),
  ]
  </code></pre>
  <p>Traceback is</p>
  <pre><code>Traceback:
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/core/handlers/exception.py&quot; in inner
    41.             response = get_response(request)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/core/handlers/base.py&quot; in _get_response
    187.                 response = self.process_exception_by_middleware(e, request)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/core/handlers/base.py&quot; in _get_response
    185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File &quot;/Users/xxx/testapp/app/views.py&quot; in index
    8.     return render('./index.html',json_dict)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/shortcuts.py&quot; in render
    30.     content = loader.render_to_string(template_name, context, request, using=using)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loader.py&quot; in render_to_string
    67.         template = get_template(template_name, using=using)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loader.py&quot; in get_template
    21.             return engine.get_template(template_name)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/backends/django.py&quot; in get_template
    39.             return Template(self.engine.get_template(template_name), self)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/engine.py&quot; in get_template
    162.         template, origin = self.find_template(template_name)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/engine.py&quot; in find_template
    136.                         name, template_dirs=dirs, skip=skip,
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loaders/base.py&quot; in get_template
    38.                 contents = self.get_contents(origin)
  
  File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loaders/filesystem.py&quot; in get_contents
    28.             with io.open(origin.name, encoding=self.engine.file_charset) as fp:
  
  Exception Type: OSError at /app/
  Exception Value: [Errno 63] File name too long: &quot;/Users/xxx/testapp/templates/jinja2/{'items': [{'---': '---', ‘A’: ‘a’, ‘B’: ‘b’, ‘C: ‘c’, ‘D’: ‘d’}]}
  </code></pre>
  <p>After editing by an answer,I got an error TypeError at /app/
  <strong>init</strong>() got an unexpected keyword argument 'match_extension' .
  Traceback says
  Traceback:</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/utils.py&quot; in <strong>getitem</strong>
  65.             return self._engines[alias]</p>
  <p>During handling of the above exception ('django'), another exception occurred:</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/core/handlers/exception.py&quot; in inner
  41.             response = get_response(request)</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/core/handlers/base.py&quot; in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/core/handlers/base.py&quot; in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)</p>
  <p>File &quot;/Users/xxx/testapp/app/views.py&quot; in index
  13.     return render(request, 'jinja2/index.html', {'json_dict': json_dict})</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/shortcuts.py&quot; in render
  30.     content = loader.render_to_string(template_name, context, request, using=using)</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loader.py&quot; in render_to_string
  67.         template = get_template(template_name, using=using)</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loader.py&quot; in get_template
  18.     engines = _engine_list(using)</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/loader.py&quot; in _engine_list
  72.     return engines.all() if using is None else [engines[using]]</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/utils.py&quot; in all
  89.         return [self[alias] for alias in self]</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/utils.py&quot; in 
  89.         return [self[alias] for alias in self]</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/utils.py&quot; in <strong>getitem</strong>
  80.             engine = engine_cls(params)</p>
  <p>File &quot;/Users/xxx/myenv/lib/python3.5/site-packages/django/template/backends/django.py&quot; in <strong>init</strong>
  32.         self.engine = Engine(self.dirs, self.app_dirs, **options)</p>
  <p>Exception Type: TypeError at /app/
  Exception Value: <strong>init</strong>() got an unexpected keyword argument 'match_extension'</p>