Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #5507 -- Use a more portable way to get at the system's tmpdir …

…(fixes a

problem with the default on Windows). Thanks, Philippe Raoult.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7329 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9e47cc2e518cf14a55845b65007fabe8a6b00da7 1 parent 6417f52
Malcolm Tredinnick authored March 20, 2008
2  django/conf/global_settings.py
@@ -287,7 +287,7 @@
287 287
 SESSION_SAVE_EVERY_REQUEST = False                      # Whether to save the session data on every request.
288 288
 SESSION_EXPIRE_AT_BROWSER_CLOSE = False                 # Whether sessions expire when a user closes his browser.
289 289
 SESSION_ENGINE = 'django.contrib.sessions.backends.db'  # The module to store session data
290  
-SESSION_FILE_PATH = '/tmp/'                             # Directory to store session files if using the file session module
  290
+SESSION_FILE_PATH = None                                # Directory to store session files if using the file session module. If set to None the backend will use a sensible default.
291 291
 
292 292
 #########
293 293
 # CACHE #
4  django/contrib/sessions/backends/file.py
@@ -9,7 +9,9 @@ class SessionStore(SessionBase):
9 9
     Implements a file based session store.
10 10
     """
11 11
     def __init__(self, session_key=None):
12  
-        self.storage_path = getattr(settings, "SESSION_FILE_PATH", tempfile.gettempdir())
  12
+        self.storage_path = getattr(settings, "SESSION_FILE_PATH", None)
  13
+        if not self.storage_path:
  14
+            self.storage_path = tempfile.gettempdir()
13 15
 
14 16
         # Make sure the storage path is valid.
15 17
         if not os.path.isdir(self.storage_path):
8  docs/sessions.txt
@@ -48,10 +48,10 @@ Using file-based sessions
48 48
 To use file-based sessions, set the ``SESSION_ENGINE`` setting to
49 49
 ``"django.contrib.sessions.backends.file"``.
50 50
 
51  
-You might also want to set the ``SESSION_FILE_PATH`` setting (which
52  
-defaults to ``/tmp``) to control where Django stores session files. Be
53  
-sure to check that your Web server has permissions to read and write to
54  
-this location.
  51
+You might also want to set the ``SESSION_FILE_PATH`` setting (which defaults
  52
+to output from ``tempfile.gettempdir()``, most likely  ``/tmp``) to control
  53
+where Django stores session files. Be sure to check that your Web server has
  54
+permissions to read and write to this location.
55 55
 
56 56
 Using cache-based sessions
57 57
 --------------------------

0 notes on commit 9e47cc2

Please sign in to comment.
Something went wrong with that request. Please try again.