title: How to save (store) PDF file generated by weasyprint to specified directory?
body: <p>I need my <strong>pdf</strong> files that is generated by <strong>weasyprint</strong> to be some specified folder, for example in the folder "<strong>my_project/pdf_files/</strong>"</p>
  
  <p>NOTE: I am using django framework for my project. And here is the structure of project.</p>
  
  <pre><code>my_project/
  
  ----pdf_generator_app/
  
  --------admin.py
  
  --------models.py
  
  --------views.py
  
  pdf_files/
  </code></pre>
  
  <p>Currently I have this in my <strong>views.py</strong></p>
  
  <pre><code>def generate(student_id):
      student = get_object_or_404(Student, application_id=student_id)
      html = render_to_string('contract.html', {'student': student})
      response = HttpResponse(content_type='application/pdf')
      response['Content-Disposition'] = 'filename="some_file.pdf"'
      weasyprint.HTML(string=html).write_pdf('myfile.pdf', 
                                             presentational_hints=True,
                                             stylesheets=[weasyprint.CSS(settings.STATIC_ROOT + '/css/styles.css')])
      return response
  </code></pre>
  
  <p>But this view does not store pdf file to a directory. It simply show file on browser. I need the file to be stored in the directory <strong>my_project/pdf_files/</strong></p>