Proper POST file upload (load testing with Locust)
<p>I'm trying to make a load test for Django-based website.</p>

<p>I use Locust 0.7.3 and python 2.7.10</p>

<p>Here I make POST - filling the form and attaching some file:</p>

<pre><code>class WebsiteTasks(TaskSet):
    def on_start(self):
        self.client.get("/")

    @task
    def submit(self):
        response = self.client.get("/submit/")
        csrftoken = response.cookies['csrftoken']
        attach = open('file.pdf', 'rb')

        r = self.client.post("/submit/", {
           'csrfmiddlewaretoken': csrftoken,
           'password': smart_str(u'wkefjgui'),
           'payload': smart_str(u'kjsdgfljdsh'),
           'docfile': attach,
           'commit': smart_str(u'Вкрапить / Embed'),
        })
</code></pre>

<p>Everything's seemed to be ok, but on the server's upload folder there's no file!</p>

<p>What I'm doing wrong?</p>