title: python - making file downloadable
body: <p>I want to make a PDF file in my project directory to be downloable instead of opening in the browser when a user clicks the link.</p>
  
  <p>I followed this question <a href="https://stackoverflow.com/questions/908258/generating-file-to-download-with-django">Generating file to download with Django</a></p>
  
  <p>But I'm getting error:</p>
  
  <pre><code>Exception Type: SyntaxError
  Exception Value: can't assign to literal (views.py, line 119)
  Exception Location: /usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in import_module, line 35
  </code></pre>
  
  <p>I created a download link:</p>
  
  <pre><code> &lt;a href="/files/pdf/resume.pdf" target="_blank" class="btn btn-success btn-download" id="download" &gt;Download PDF&lt;/a&gt;
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>url(r'^files/pdf/(?P&lt;filename&gt;\{w{40})/$', 'github.views.pdf_download'),
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def pdf_download(request, filename):
      path = os.expanduser('~/files/pdf/')
      f = open(path+filename, "r")
      response = HttpResponse(FileWrapper(f), content_type='application/pdf')
      response = ['Content-Disposition'] = 'attachment; filename=resume.pdf'
      f.close()
      return response
  </code></pre>
  
  <p>The Error Line is:</p>
  
  <pre><code>response = ['Content-Disposition'] = 'attachment; filename=resume.pdf'
  </code></pre>
  
  <p>How can I make it downloable?</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>It is working in Firefox but not in Chrome v21.0.</p>