Django already has a tempdir for tests which you should be able to reuse, see https://github.com/django/django/blob/master/tests/runtests.py#L22