Commits

Brodie Rao  committed f7591a1

Add a GEORDI_OUTPUT_DIR setting

  • Participants
  • Parent commits f06941f

Comments (0)

Files changed (2)

 configured `time limits on requests`_, you can set ``GEORDI_CELERY = True`` to
 run the profiler in a background `Celery`_ task.
 
+If you're running multiple front-end servers and need PDFs to be saved
+to a shared directory, set ``GEORDI_OUTPUT_DIR``. If it's not set, the
+temporary directory provided by the system is used.
+
 .. _Django: https://www.djangoproject.com/
 .. _middleware: https://docs.djangoproject.com/en/dev/topics/http/middleware/
 .. _Django settings: https://docs.djangoproject.com/en/dev/topics/settings/

File geordi/__init__.py

     @task
     def profiletask(srequest, options):
         """Profile a request in a background Celery task"""
+        outputdir = getattr(settings, 'GEORDI_OUTPUT_DIR', None)
         with tempfile.NamedTemporaryFile(prefix='geordi-', suffix='.pdf',
+                                         dir=outputdir,
                                          delete=False) as outfile:
             outfile.write(srequest.profile(options))
             return outfile.name